Skip to content

Color

Defined in: utils/color.ts:10

Constructors

new Color()

new Color(r?, g?, b?): Color

Defined in: utils/color.ts:31

A Color reresented by a red, green and blue component.

Parameters

r?

number

The red component of the Color OR the full Color in HEX.

g?

number

The green component of the Color.

b?

number

The blue component of the Color.

Returns

Color

Properties

b

b: number

Defined in: utils/color.ts:23


g

g: number

Defined in: utils/color.ts:22


r

r: number

Defined in: utils/color.ts:21


BLACK

readonly static BLACK: Color

Defined in: utils/color.ts:12


BLUE

readonly static BLUE: Color

Defined in: utils/color.ts:16


CYAN

readonly static CYAN: Color

Defined in: utils/color.ts:19


GREEN

readonly static GREEN: Color

Defined in: utils/color.ts:15


GREY

readonly static GREY: Color

Defined in: utils/color.ts:13


MAGENTA

readonly static MAGENTA: Color

Defined in: utils/color.ts:18


RED

readonly static RED: Color

Defined in: utils/color.ts:14


WHITE

readonly static WHITE: Color

Defined in: utils/color.ts:11


YELLOW

readonly static YELLOW: Color

Defined in: utils/color.ts:17

Methods

toHex()

toHex(): number

Defined in: utils/color.ts:111

Convert this Color to hex.

Returns

number

The Color in hex format.


toHexString()

toHexString(): string

Defined in: utils/color.ts:115

Returns

string


toWebGL()

toWebGL(): number[]

Defined in: utils/color.ts:123

Converts the Color components to the 0…1 range.

Returns

number[]

The new Color.


lerp()

static lerp(pA, b, pPerc): Color

Defined in: utils/color.ts:90

Creates a new Color that is linearly interpolated from

Parameters

pA

Color

The start Color.

b

Color

The end Color.

pPerc

number

The percentage on the path from

Returns

Color

The new Color.

Var

pA to

Var

b .

Var

pA to

Var

b .


lerpHex()

static lerpHex(pA, b, pPerc): number

Defined in: utils/color.ts:101

Creates a new hex Color that is linearly interpolated from

Parameters

pA

number

The first Color hex.

b

number

The second Color hex.

pPerc

number

The percentage along the path from

Returns

number

The new hex Color.

Var

pA to

Var

b .

Var

pA to

Var

b .


random()

static random(): Color

Defined in: utils/color.ts:50

Creates a random Color.

Returns

Color

The new Color.


rgbToFullHexString()

static rgbToFullHexString(r, g, b): string

Defined in: utils/color.ts:75

Parameters

r

number

g

number

b

number

Returns

string


rgbToHex()

static rgbToHex(r, g, b): number

Defined in: utils/color.ts:61

Converts the rgb values passed in to hex.

Parameters

r

number

The red component to convert.

g

number

The green component to convert.

b

number

The blue component to convert.

Returns

number

The hex value.


rgbToHexString()

static rgbToHexString(pNumber): string

Defined in: utils/color.ts:66

Parameters

pNumber

number

Returns

string