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.

hex: string

alpha

Alpha of the color.

alpha: number

+black

Constructs a black color.

static black(): Color

+darkGray

Constructs a dark gray color.

static darkGray(): Color

+lightGray

Constructs a light gray color.

static lightGray(): Color

+white

Constructs a white color.

static white(): Color

+gray

Constructs a gray color.

static gray(): Color

+red

Constructs a red color.

static red(): Color

+green

Constructs a green color.

static green(): Color

+blue

Constructs a blue color.

static blue(): Color

+cyan

Constructs a cyan color.

static cyan(): Color

+yellow

Constructs a yellow color.

static yellow(): Color

+magenta

Constructs a magenta color.

static magenta(): Color

+orange

Constructs a orange color.

static orange(): Color

+purple

Constructs a purple color.

static purple(): Color

+brown

Constructs a brown color.

static brown(): Color

+clear

Constructs a transparent color.

static clear(): Color

-new Color

Constructs a color.

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.

new Color(hex: string, alpha: number)