Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Color

Represents a color containing RGBA components.

Hierarchy

  • Color

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Color(r?: number, g?: number, b?: number, a?: number): Color
  • Creates a new color with the specified components (in range 0-1).

    Parameters

    • Default value r: number = 0

      The R (red) component.

    • Default value g: number = 0

      The G (green) component.

    • Default value b: number = 0

      The B (blue) component.

    • Default value a: number = 1

      The A (alpha) component.

    Returns Color

Properties

Private _array3

_array3: Float32Array

Private _array4

_array4: Float32Array

Accessors

a

  • get a(): number
  • set a(value: number): void
  • The A (alpha) component.

    Returns number

  • The A (alpha) component.

    Parameters

    • value: number

    Returns void

b

  • get b(): number
  • set b(value: number): void
  • The B (blue) component.

    Returns number

  • The B (blue) component.

    Parameters

    • value: number

    Returns void

g

  • get g(): number
  • set g(value: number): void
  • The G (green) component.

    Returns number

  • The G (green) component.

    Parameters

    • value: number

    Returns void

r

  • get r(): number
  • set r(value: number): void
  • The R (red) component.

    Returns number

  • The R (red) component.

    Parameters

    • value: number

    Returns void

rgb

  • get rgb(): Float32Array
  • The color as an typed array containing RGB.

    Returns Float32Array

rgba

  • get rgba(): Float32Array
  • The color as an typed array containing RGBA.

    Returns Float32Array

Methods

Static from

  • from(source: number[] | Float32Array): Color
  • Creates a new color from the specified source.

    Parameters

    • source: number[] | Float32Array

      The source to create the color from.

    Returns Color

Static fromBytes

  • fromBytes(r?: number, g?: number, b?: number, a?: number): Color
  • Creates a new color with the specified components (in range 0-255).

    Parameters

    • Default value r: number = 0

      The R (red) component.

    • Default value g: number = 0

      The G (green) component.

    • Default value b: number = 0

      The B (blue) component.

    • Default value a: number = 255

      The A (alpha) component.

    Returns Color

Generated using TypeDoc