Color

Color

Holds a color that can be retrieved with Color#toRGB

Constructor

new Color(color)

Source:
Parameters:
Name Type Description
color Color | String | Number | RGBColor

Can either be a CSS, Hex or RGB Color

Throws:

Classes

Color

Members

value :Array.<Number>

The currently stored color

Source:
Type:
  • Array.<Number>

Methods

(static) CSSToRGB(css, includeAlphaopt) → {RGBColor}

Converts the specified css color to an RGB one

Source:
Parameters:
Name Type Attributes Default Description
css String

The name of the color to convert

includeAlpha Boolean <optional>
true

Whether or not to include Alpha in the return value

Throws:
Returns:
Type:
RGBColor

The specified css color as an RGB one

(static) getType(color) → {ColorType}

Returns the type of the specified color and whether or not it is valid

Source:
Parameters:
Name Type Description
color Color | String | Number | RGBColor

The color to analyze

Returns:
Type:
ColorType

An Object containing the color's type and whether or not it's valid

(static) HexToRGB(hex, includeAlphaopt) → {RGBColor}

Converts the specified hex color to an RGB one

Source:
Parameters:
Name Type Attributes Default Description
hex String

The hex color to convert

includeAlpha Boolean <optional>
true

Whether or not to include Alpha in the return value

Throws:
Returns:
Type:
RGBColor

The specified hex color as an RGB one

copy() → {Color}

Returns a copy of this Color

Source:
Throws:
Returns:
Type:
Color

A copy of this Color

toCSS() → {String|undefined}

Returns Color#value as a CSS color

Source:
Throws:
Returns:
Type:
String | undefined

Color#value as a CSS color

toHex(includeAlphaopt) → {String}

Returns Color#value as a valid hex color

Source:
Parameters:
Name Type Attributes Default Description
includeAlpha Boolean <optional>
true

Whether or not to include Alpha in the return value

Throws:
Returns:
Type:
String

Color#value as a valid hex color

toRGB(includeAlphaopt) → {RGBColor}

Returns Color#value as a valid RGB color

Source:
Parameters:
Name Type Attributes Default Description
includeAlpha Boolean <optional>
true

Whether or not to include Alpha in the return value

Throws:
Returns:
Type:
RGBColor

Color#value as a valid RGB color