Class Colors
- Namespace
- UILib
- Assembly
- UILib.dll
A class for helping with generating colors using a variety of color representations.
public static class Colors
- Inheritance
-
Colors
- Inherited Members
Methods
HSL(float, float, float)
Creates a Color from hue, saturation, and lightness.
public static Color HSL(float h, float s, float l)
Parameters
Returns
- Color
The
Color
HSLA(float, float, float, float)
Creates a Color from hue, saturation, lightness, and alpha.
public static Color HSLA(float h, float s, float l, float a)
Parameters
hfloatThe hue (0-360)
sfloatThe saturation (0-100)
lfloatThe lightness (0-100)
afloatThe alpha (0-100)
Returns
- Color
The
Color
HSV(float, float, float)
Creates a Color from hue, saturation, and value.
public static Color HSV(float h, float s, float v)
Parameters
Returns
- Color
The
Color
HSVA(float, float, float, float)
Creates a Color from hue, saturation, value, and alpha.
public static Color HSVA(float h, float s, float v, float a)
Parameters
hfloatThe hue (0-360)
sfloatThe saturation (0-100)
vfloatThe value (0-100)
afloatThe alpha (0-100)
Returns
- Color
The
Color
Hex(int)
Creates a Color from a hex value of the form
0xRRGGBB.
public static Color Hex(int hex)
Parameters
hexintThe hex value
Returns
- Color
The
Color
HexA(int)
Creates a Color from a hex value of the form
0xRRGGBBAA.
public static Color HexA(int hexA)
Parameters
hexAintThe hex value (including the alpha component)
Returns
- Color
The
Color
RGB(float, float, float)
Creates a Color from red, green, and blue
components.
public static Color RGB(float r, float g, float b)
Parameters
Returns
- Color
The
Color
RGBA(float, float, float, float)
Creates a Color from red, green, blue, and alpha
components.
public static Color RGBA(float r, float g, float b, float a)
Parameters
rfloatThe red value (0-255)
gfloatThe green value (0-255)
bfloatThe blue value (0-255)
afloatThe alpha value (0-100)
Returns
- Color
The
Color
RGBAToHex(int, int, int, int)
Converts RGB values to a hex value in the form 0xRRGGBBAA.
public static int RGBAToHex(int r, int g, int b, int a)
Parameters
rintThe red component (0-255)
gintThe green component (0-255)
bintThe blue component (0-255)
aintThe alpha component (0-100)
Returns
- int
The hex value
RGBToHSL(float, float, float)
Converts RGB to HSL.
The returned HSL will be: H: [0, 360] S: [0, 100] L: [0, 100]
See: https://en.wikipedia.org/wiki/HSL_and_HSV#Color_conversion_formulae
public static Vector3 RGBToHSL(float r, float g, float b)
Parameters
rfloatThe red component (0-255)
gfloatThe green component (0-255)
bfloatThe blue component (0-255)
Returns
- Vector3
The HSL values
RGBToHSV(float, float, float)
Converts RGB to HSV.
The returned HSV will be: H: [0, 360] S: [0, 100] V: [0, 100]
See: https://en.wikipedia.org/wiki/HSL_and_HSV#Color_conversion_formulae
public static Vector3 RGBToHSV(float r, float g, float b)
Parameters
rfloatThe red component (0-255)
gfloatThe green component (0-255)
bfloatThe blue component (0-255)
Returns
- Vector3
The HSV values
RGBToHex(int, int, int)
Converts RGB values to a hex value in the form 0xRRGGBB.
public static int RGBToHex(int r, int g, int b)
Parameters
Returns
- int
The hex value