Table of Contents

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

h float

The hue (0-360)

s float

The saturation (0-100)

l float

The lightness (0-100)

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

h float

The hue (0-360)

s float

The saturation (0-100)

l float

The lightness (0-100)

a float

The 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

h float

The hue (0-360)

s float

The saturation (0-100)

v float

The value (0-100)

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

h float

The hue (0-360)

s float

The saturation (0-100)

v float

The value (0-100)

a float

The 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

hex int

The 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

hexA int

The 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

r float

The red value (0-255)

g float

The green value (0-255)

b float

The blue value (0-255)

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

r float

The red value (0-255)

g float

The green value (0-255)

b float

The blue value (0-255)

a float

The 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

r int

The red component (0-255)

g int

The green component (0-255)

b int

The blue component (0-255)

a int

The 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

r float

The red component (0-255)

g float

The green component (0-255)

b float

The 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

r float

The red component (0-255)

g float

The green component (0-255)

b float

The 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

r int

The red component (0-255)

g int

The green component (0-255)

b int

The blue component (0-255)

Returns

int

The hex value