Class: Color

Color(redopt, greenopt, blueopt)

The Color class represents a color in the RGB color space.

Constructor

new Color(redopt, greenopt, blueopt)

Creates a color instance from RGB values.

Parameters:
Name Type Attributes Description
red number | string <optional>

The red component or the RGB value.

green number <optional>

The green component.

blue number <optional>

The blue component.

Classes

Color

Members

blue :number

The blue component of the color.

Type:
  • number

green :number

The green component of the color.

Type:
  • number

red :number

The red component of the color.

Type:
  • number

rgb :number

The RGB value of the color.

Type:
  • number

Methods

brighter(factoropt) → {Color}

Creates a new color that is brighter than this color.

Parameters:
Name Type Attributes Description
factor number <optional>

The optional factor to brighten the color.

Returns:

The brighter color.

Type
Color

darker(factoropt) → {Color}

Creates a new color that is darker than this color.

Parameters:
Name Type Attributes Description
factor number <optional>

The optional factor to darken the color.

Returns:

The darker color.

Type
Color

toString() → {string}

Returns the hexadecimal representation of the color.

Returns:

The hexadecimal representation of the color.

Type
string

valueOf() → {number}

Returns the RGB value of the color.

Returns:

The RGB value of the color.

Type
number