ColorUtility¶
Namespace:
SideXP.Core
Miscellaneous functions for working with Color and Color32 values.
Fields¶
MaxColorValue¶
The maximum color value.
MaxColorValueFloat¶
The maximum color value as float.
Methods¶
ToHexRGB(Color)¶
Converts the given color into an hexadecimal string value.
Parameters
color: The color to convert.
Returns
Returns the "color string" with format "RRGGBB".
ToHexRGB(Color32)¶
Converts the given color into an hexadecimal string value.
Parameters
color: The color to convert.
Returns
Returns the "color string" with format "RRGGBB".
ToHexRGBA(Color)¶
Converts the given color into an hexadecimal string value.
Parameters
color: The color to convert.
Returns
Returns the "color string" with format "RRGGBBAA".
ToHexRGBA(Color32)¶
Returns
Returns the "color string" with format "RRGGBBAA".
FromHex(Color, string)¶
Sets the given color values from the given hexadecimal string.
Parameters
color: The color to override.hexString: The hexadecimal string: - #RGB (becomes RRGGBB) - #RRGGBB - #RGBA (becomes RRGGBBAA) - #RRGGBBAA
Returns
Returns true if the string has been parsed successfully.
FromHex(string)¶
Creates a color value from the given hexadecimal string.
Parameters
hexString: The hexadecimal string: - #RGB (becomes RRGGBB) - #RRGGBB - #RGBA (becomes RRGGBBAA) - #RRGGBBAA
Returns
Returns the created color value.
FromHex32(Color32, string)¶
Sets the given color values from the given hexadecimal string.
Parameters
color: The color to override.hexString: The hexadecimal string: - #RGB (becomes RRGGBB) - #RRGGBB - #RGBA (becomes RRGGBBAA) - #RRGGBBAA
Returns
Returns true if the string has been parsed successfully.
FromHex32(string)¶
Inherited documentation.
GenerateRandomColor(int)¶
Generates a random color.
Parameters
subdivs: The number of subdivs a single color channel can have when generating random color. As an example, if you set 2, a channel can get value 0, 0.5 or 1. Values below 1 are clamped to 1 (a channel then gets only 0 or 1).
Returns
Returns the generated color.
GetOverlayTint(Color)¶
Gets the appropriate tint to make the content over the given color as visible as possible.
Parameters
color: The color to process.
Returns
Returns black if the grayscale of the given color is over 0.5, otherwise white.
GetOverlayTint(Color32)¶
Gets the appropriate tint to make the content over the given color as visible as possible.
Parameters
color: The color to process.
Returns
Returns black if the grayscale of the given color is over 0.5, otherwise white.