Aspose::Cells::Color::FromHex method

Color::FromHex method

Creates a Color from a hexadecimal color string.

static Color Aspose::Cells::Color::FromHex(const U16String &hex)
ParameterTypeDescription
hexconst U16String&A UTF-16 string representing a color in hexadecimal format. Supported formats include #RRGGBB, RRGGBB, #AARRGGBB, and AARRGGBB.

ReturnValue

A Color structure that corresponds to the specified hexadecimal value.

Remarks

If the alpha component is not specified, it defaults to 255 (fully opaque).

Examples

auto c1 = Color::FromHex(u"#ff0000");   // a=255, r=255, g=0, b=0
auto c2 = Color::FromHex(u"80ff0000");  // a=128, r=255, g=0, b=0

See Also