API reference
Preparing search index…

RGBA color with four one-byte channels in the range 0 to 255. Channel writes convert according to Uint8Array rules; storage is shared with Native as needed.

Source & inheritance
Member directory18

Constructors

Properties

Accessors

Methods

Constructors

  • Creates opaque black, RGBA (0, 0, 0, 255).

    Returns

    Source & inheritance
  • Creates a color from four color channels.

    Parameters

    red
    number

    Red channel.

    green
    number

    Green channel.

    blue
    number

    Blue channel.

    alphaOptional
    number

    Opacity: 0 is fully transparent and 255 is opaque; defaults to 255.

    Returns

    Source & inheritance
  • Creates a color from a 0xRRGGBBAA integer, with byte order independent of host endianness.

    Parameters

    color
    number

    RGBA integer, such as 0xff0000ff for opaque red.

    Returns

    Source & inheritance
  • Creates an independent copy of a color.

    Parameters

    source

    Color to copy.

    Returns

    Source & inheritance

Properties

Black: ReadonlyValue<Color> = ...

Opaque black, RGBA (0, 0, 0, 255). Read-only.

Source & inheritance
Blue: ReadonlyValue<Color> = ...

Opaque blue, RGBA (0, 0, 255, 255). Read-only.

Source & inheritance
Cyan: ReadonlyValue<Color> = ...

Opaque cyan, RGBA (0, 255, 255, 255). Read-only.

Source & inheritance
Green: ReadonlyValue<Color> = ...

Opaque green, RGBA (0, 255, 0, 255). Read-only.

Source & inheritance
Magenta: ReadonlyValue<Color> = ...

Opaque magenta, RGBA (255, 0, 255, 255). Read-only.

Source & inheritance
Red: ReadonlyValue<Color> = ...

Opaque red, RGBA (255, 0, 0, 255). Read-only.

Source & inheritance
Transparent: ReadonlyValue<Color> = ...

Fully transparent black, RGBA (0, 0, 0, 0). Read-only.

Source & inheritance
White: ReadonlyValue<Color> = ...

Opaque white, RGBA (255, 255, 255, 255). Read-only.

Source & inheritance
Yellow: ReadonlyValue<Color> = ...

Opaque yellow, RGBA (255, 255, 0, 255). Read-only.

Source & inheritance

Accessors

  • get a(): number

    Alpha channel: 0 is fully transparent and 255 is fully opaque.

    Returns

    number
    Source & inheritance
  • set a(value: number): void

    Sets the alpha channel.

    Parameters

    value
    number

    Opacity, converted to an unsigned 8-bit integer for storage.

    Returns

    void

    When modifying a read-only color constant.

    Source & inheritance
  • get b(): number

    Blue channel in the range 0 to 255. Writes convert according to Uint8Array rules.

    Returns

    number
    Source & inheritance
  • set b(value: number): void

    Sets the blue channel.

    Parameters

    value
    number

    Blue component, converted to an unsigned 8-bit integer for storage.

    Returns

    void

    When modifying a read-only color constant.

    Source & inheritance
  • get g(): number

    Green channel in the range 0 to 255. Writes convert according to Uint8Array rules.

    Returns

    number
    Source & inheritance
  • set g(value: number): void

    Sets the green channel.

    Parameters

    value
    number

    Green component, converted to an unsigned 8-bit integer for storage.

    Returns

    void

    When modifying a read-only color constant.

    Source & inheritance
  • get r(): number

    Red channel in the range 0 to 255. Writes convert according to Uint8Array rules.

    Returns

    number
    Source & inheritance
  • set r(value: number): void

    Sets the red channel.

    Parameters

    value
    number

    Red component, converted to an unsigned 8-bit integer for storage.

    Returns

    void

    When modifying a read-only color constant such as Color.Red.

    Source & inheritance

Methods

  • Encodes the color as an unsigned 32-bit integer.

    Returns

    number

    RGBA value in 0xRRGGBBAA format, independent of host endianness.

    Source & inheritance

Symbol members

"[mutableValue]": true
Source & inheritance
  • get "[colorNative]"(): NativeValueHandle<"color">

    Returns

    NativeValueHandle<"color">
    Source & inheritance

Icons made by Lorc, Delapouite & Skoll · game-icons.net · CC BY 3.0