ColorUtils
An utility class containing usefull functions related to editor coloring.
- Inheritance:
object -> ColorUtils
- Namespace:
EditorAttributes.Editor.Utility
- Assembly:
EditorAttributes.Editor.asmdef
Syntax:
public static class ColorUtils
Methods
ApplyColor(VisualElement, IColorAttribute, HelpBox)
Applies a color to a visual element via the color attribute.
Declaration:
public static void ApplyColor(VisualElement visualElement, IColorAttribute color, HelpBox errorBox)
- Parameters:
VisualElementvisualElement: The visual element to colorIColorAttributecolor: The color attributeHelpBoxerrorBox: The error box to display any errors to
ApplyColor(VisualElement, Color, int)
Applies a color to a visual element.
Declaration:
public static void ApplyColor(VisualElement visualElement, Color color, int delay = 50)
- Parameters:
VisualElementvisualElement: The visual element to colorColorcolor: The color to applyoptional,
intdelay: How many milliseconds to delay before applying the color
GetColorFromProperty(SerializedProperty)
Gets the color from a serialzied property with a color attribute.
Declaration:
public static Color? GetColorFromProperty(SerializedProperty property)
- Parameters:
SerializedPropertyproperty: The property to get the color from
Returns: Color?: The color from the attribute, null if the attribute is not found
GetColorFromAttribute(IColorAttribute, HelpBox)
Gets the color value from a color attribute
Declaration:
public static Color GetColorFromAttribute(IColorAttribute attribute, HelpBox errorBox)
- Parameters:
SerializedPropertyattribute: The color attributeHelpBoxerrorBox: The error box to display any errors to
Returns: Color: The color from the attribute
GetColorFromAttribute(IColorAttribute, float, HelpBox)
Gets the color value from a color attribute with custom alpha
Declaration:
public static Color GetColorFromAttribute(IColorAttribute attribute, float alpha, HelpBox errorBox)
- Parameters:
SerializedPropertyattribute: The color attributefloatalpha: Custom transparency valueHelpBoxerrorBox: The error box to display any errors to
Returns: Color: The color from the attribute
ColorAttributeToColor(IColorAttribute)
Converts the color attribute values from the color attribute to a color
Declaration:
public static Color ColorAttributeToColor(IColorAttribute colorAttribute)
- Parameters:
IColorAttributecolorAttribute: The color attribute
Returns: Color: The color value
ColorAttributeToColor(IColorAttribute, float)
Converts the color attribute values from the color attribute to a color
Declaration:
public static Color ColorAttributeToColor(IColorAttribute colorAttribute, float alpha)
- Parameters:
IColorAttributecolorAttribute: The color attributefloatalpha: Custom transparency value
Returns: Color: The color value
GUIColorToColor(GUIColor)
Converts the GUIColor value to a color
Declaration:
public static Color GUIColorToColor(GUIColor color)
- Parameters:
GUIColorcolor: The color value
Returns: Color: The color value
GUIColorToColor(GUIColor, float)
Converts the GUIColor value to a color
Declaration:
public static Color GUIColorToColor(GUIColor color, float alpha)
- Parameters:
GUIColorcolor: The color valuefloatalpha: Custom transparency value
Returns: Color: The color value