Class: Color

Color

new Color(r, g, b, a)

Create a new color.

Parameters:
Name Type Argument Default Description
r Number

Red value, ranging 0.0 to 1.0.

g Number

Green value, ranging 0.0 to 1.0.

b Number

Blue value, ranging 0.0 to 1.0.

a Number <optional>
1.0

Alpha value, ranging 0.0 to 1.0.

Source:
  • color.js, line 39

Members

<static, constant> BLACK

Black color: (0.0, 0.0, 0.0)

Source:
  • color.js, line 127

<static, constant> BLACK

Black color: (0.0, 0.0, 0.0)

Source:
  • color.js, line 99

<static, constant> BLUE

Blue color: (0.0, 0.0, 1.0)

Source:
  • color.js, line 92

<static, constant> CYAN

Cyan color: (0.0, 1.0, 1.0)

Source:
  • color.js, line 156

<static, constant> DARKGRAY

Dark gray color: (0.333, 0.333, 0.333)

Source:
  • color.js, line 113

<static, constant> GRAY

Gray color: (0.5, 0.5, 0.5)

Source:
  • color.js, line 106

<static, constant> GREEN

Green color: (0.0, 1.0, 0.0)

Source:
  • color.js, line 85

<static, constant> LIGHTGRAY

Light gray color: (0.667, 0.667, 0.667)

Source:
  • color.js, line 120

<static, constant> PURPLE

Purple color: (1.0, 0.0, 1.0)

Source:
  • color.js, line 149

<static, constant> RED

Red color: (1.0, 0.0, 0.0)

Source:
  • color.js, line 78

<static, constant> WHITE

White color: (1.0, 1.0, 1.0)

Source:
  • color.js, line 135

<static, constant> YELLOW

Yellow color: (1.0, 1.0, 0.0)

Source:
  • color.js, line 142

alpha

Alpha value.

Source:
  • color.js, line 50

blue

Blue value.

Source:
  • color.js, line 47

green

Green value.

Source:
  • color.js, line 44

red

Red value.

Source:
  • color.js, line 41

Methods

blend(color) → {Color}

Blend the color evenly with specified color.

Parameters:
Name Type Description
color Color

The color to blend with.

Source:
  • color.js, line 59
Returns:

The new color.

Type
Color

blendWeighted(color, weight1, weight2) → {Color}

Blend the color weighted with specified color.

Parameters:
Name Type Description
color Color

The color to blend with.

weight1 Number

The weight for the 'this' color, ranging 0.0 to 1.0.

weight2 Number

The weight for the specified color, ranging 0.0 to 1.0.

Source:
  • color.js, line 70
Returns:

The new color.

Type
Color