Skip to content

Color

Color is a data type that represents a color.

The alpha property is between 0 and 1. 0 is fully transparent and 1 is fully visible.

Properties

  • R: number
  • G: number
  • B: number
  • A: number

Methods

New() → Color

Creates a new Color with the set R, G, B and A values

New(d: number) → Color

Creates a new Color with the set R, G, B and A values

New(r: number, g: number, b: number) → Color

Creates a new Color with the set R, G, B and A values

New(r: number, g: number, b: number, a: number) → Color

Creates a new Color with the set R, G, B and A values

Random() → Color

Returns a random color with an alpha value of 1.

FromHex(hex: string) → Color

Creates a new Color from the specified hex value.

Lerp(a: Color, b: Color, t: number) → Color

Linearly interpolates colors a and b by t.