Color

new Color(r, g, b, a)

Parameters:
NameTypeDefaultDescription
rnumber

Red value of the color.

gnumber

Green value of the color.

bnumber

Blue value of the color.

anumber1

Alpha value of the color.

Methods

(static) FromHex(hex) → {Color}

Generate Color from A Hexadecimal string.

Parameters:
NameTypeDefaultDescription
hexnumber0x000000

The hex value of the color.

Returns:

The color.

Type: 
Color

(static) FromHSL(h, s, l) → {Color}

Generate a color from HSL values.

Parameters:
NameTypeDescription
hnumber

Hue value of the color.

snumber

Saturation value of the color.

lnumber

Lightness value of the color.

Returns:

The color.

Type: 
Color

(static) FromRGB(r, g, b) → {Color}

Generate a color from RGB values.

Parameters:
NameTypeDescription
rnumber

Red value of the color.

gnumber

Green value of the color.

bnumber

Blue value of the color.

Returns:

The color.

Type: 
Color

(static) FromRGBA(r, g, b, a) → {Color}

Generate a color from RGBA values.

Parameters:
NameTypeDescription
rnumber

Red value of the color.

gnumber

Green value of the color.

bnumber

Blue value of the color.

anumber

Blue value of the color.

Returns:

The color.

Type: 
Color

(static) Random() → {Color}

Generate a Random Color.

Returns:

The color.

Type: 
Color

toString() → {string}

Convert the color into RGB javascript string. rgba(r,g,b,a) or rgb(r,g,b).

Returns:

The color in RGB format.

Type: 
string