Class ColorExtensions
Extensions for working with colors.
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public static class ColorExtensions
Methods
ArgbToRgbaHex(string, bool)
Convert a ARGB hex color to RGBA hex color.
Declaration
public static string ArgbToRgbaHex(string argbHex, bool alpha = true)
Parameters
Type | Name | Description |
---|---|---|
string | argbHex | The ARGB hex color. |
bool | alpha | Whether to include the alpha channel. |
Returns
Type | Description |
---|---|
string | The RGBA hex color if the string is a valid ARGB hex color, null otherwise. |
ColorToRgbaHex(Color, bool)
Convert a Color to a RGBA hex color.
Declaration
public static string ColorToRgbaHex(Color color, bool alpha = true)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to convert. |
bool | alpha | Whether to include the alpha channel. |
Returns
Type | Description |
---|---|
string | The RGBA hex color. |
IsRgbHex(string)
Check if a string is a valid RGB hex color.
Declaration
public static bool IsRgbHex(string hexColor)
Parameters
Type | Name | Description |
---|---|---|
string | hexColor | The hex color to check. |
Returns
Type | Description |
---|---|
bool | True if the string is a valid RGB hex color. |
IsValidHex(string)
Check if a string is a valid hex color.
Declaration
public static bool IsValidHex(string hexColor)
Parameters
Type | Name | Description |
---|---|---|
string | hexColor | The hex color to check. |
Returns
Type | Description |
---|---|
bool | True if the string is a valid hex color. |
RgbaToArgbHex(string)
Convert a RGBA hex color to ARGB hex color.
Declaration
public static string RgbaToArgbHex(string rgbaHex)
Parameters
Type | Name | Description |
---|---|---|
string | rgbaHex | The RGBA hex color. |
Returns
Type | Description |
---|---|
string | The ARGB hex color if the string is a valid RGBA hex color, null otherwise. |