Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a color containing RGBA components.

Hierarchy

  • Color

Index

Constructors

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

    • r: number = 0

      The R (red) component.

    • g: number = 0

      The G (green) component.

    • b: number = 0

      The B (blue) component.

    • a: number = 1

      The A (alpha) component.

    Returns Color

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

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: Float32Array | number[]): Color
  • Creates a new color from the specified source.

    Parameters

    • source: Float32Array | number[]

      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

    • r: number = 0

      The R (red) component.

    • g: number = 0

      The G (green) component.

    • b: number = 0

      The B (blue) component.

    • a: number = 255

      The A (alpha) component.

    Returns Color

Static fromHex

  • fromHex(hex: string | number): Color
  • Creates a new color from the specified hex value.

    Parameters

    • hex: string | number

      The hex value as a string or a number.

    Returns Color

Generated using TypeDoc