Description
The Hex
property provides a string representation of the color in the hexadecimal format, typically used in web development and design. The format is "#RRGGBB[AA]"
, where RR
, GG
, BB
represent the red, green, and blue components of the color, respectively, and AA
is the optional alpha component for transparency.
Usage
Use the Hex
property to obtain a hexadecimal string representation of a Color
object. This can be useful for exporting colors to formats that require hexadecimal color codes, such as CSS or certain graphics file formats.
Example
// Example of using the Hex property
Color color = new Color(1.0f, 0.5f, 0.0f, 1.0f); // Orange color
string hexValue = color.Hex;
// hexValue will be "#FF8000FF"