Skip to content

Color

Stores color data including opacity.

A color can be created using a hex value, e.g. #FF0000 and optionally an alpha or it can be created using the provided system colors.

hex

HEX representation.

Read-only.

hex: string

red

Amount of red in the color.

Read-only.

red: number

green

Amount of green in the color.

Read-only.

green: number

blue

Amount of blue in the color.

Read-only.

blue: number

alpha

Alpha of the color.

Read-only.

alpha: number

+black

Constructs a black color.

static black(): Color

Return value

Color
A black color.


+darkGray

Constructs a dark gray color.

static darkGray(): Color

Return value

Color
A dark gray color.


+lightGray

Constructs a light gray color.

static lightGray(): Color

Return value

Color
A light gray color.


+white

Constructs a white color.

static white(): Color

Return value

Color
A white color.


+gray

Constructs a gray color.

static gray(): Color

Return value

Color
A gray color.


+red

Constructs a red color.

static red(): Color

Return value

Color
A red color.


+green

Constructs a green color.

static green(): Color

Return value

Color
A green color.


+blue

Constructs a blue color.

static blue(): Color

Return value

Color
A blue color.


+cyan

Constructs a cyan color.

static cyan(): Color

Return value

Color
A cyan color.


+yellow

Constructs a yellow color.

static yellow(): Color

Return value

Color
A yellow color.


+magenta

Constructs a magenta color.

static magenta(): Color

Return value

Color
A magenta color.


+orange

Constructs a orange color.

static orange(): Color

Return value

Color
A orange color.


+purple

Constructs a purple color.

static purple(): Color

Return value

Color
A purple color.


+brown

Constructs a brown color.

static brown(): Color

Return value

Color
A brown color.


+clear

Constructs a transparent color.

static clear(): Color

Return value

Color
A transparent color.


-new Color

Constructs a color.

new Color(hex: string, alpha: number)

Constructs a new color with a hex value and optionally an alpha value. The hex value may specify the alpha value but this will be ignored if the alpha value parameter is provided. Examples of valid hex values: #ff0000, #00ff0080 #00f and #ff. The pound sign is optional.

Parameters

hex
string
Hex value.

alpha
number
Alpha value.