Hex.ToColor

Static Method in Hex

Declaration

public static Color ToColor(int hex, float alpha = 1F)

Description

Creates a color from a hexadecimal integer in the RGB format (RRGGBB), e.g., 0xffff00.

Parameters

hexThe hexadecimal integer to convert.
alphaThe alpha component of the new color.

Returns

ColorThe color formed from the hexadecimal integer.

Overload

Declaration

public static Color ToColor(string hex, float alpha = 1F)

Description

Creates a color from a hexadecimal string in the RGB format (RRGGBB), e.g., "#ffff00".

Parameters

hexThe hexadecimal string to convert.
alphaThe alpha component of the new color.

Returns

ColorThe color formed from the hexadecimal string.