Color

new Color(red, green, blue, alpha)

Parameters:
NameTypeDefaultDescription
rednumber
greennumber
bluenumber
alphanumber1

Methods

asHex() → {string}

Returns:

e.g. "#ff0000"

Type: 
string

asRgb() → {string}

Returns:

e.g. "rgb(255, 0, 0)"

Type: 
string

asRgba() → {string}

Returns:

e.g. "rgba(255, 0, 0, 1)"

Type: 
string

equals(other) → {boolean}

Parameters:
NameTypeDescription
other*
Returns:
Type: 
boolean

setOpacity(alpha)

Sets opacity (alpha channel).

Parameters:
NameTypeDescription
alphanumber

toString()

(static) fromString(value) → {Color}

Guesses the input color format and returns a Color instance.

Parameters:
NameTypeDescription
valuestring
Returns:
Type: 
Color