Interface ReadonlyColor

Read-only interface of an RGBA color.

In [0,1] range.

interface ReadonlyColor {
    a: number;
    b: number;
    g: number;
    r: number;
    clone(): Color;
    copyToARGB(array: TypedArray, offset?: number, normalized?: boolean): void;
    copyToRGB(array: TypedArray, offset?: number, normalized?: boolean): void;
    copyToRGBA(array: TypedArray, offset?: number, normalized?: boolean): void;
    equals(r: number, g: number, b: number, epsilon?: number): boolean;
    equalsColor(other: ColorLike, epsilon?: number): boolean;
    equalsColorWithAlpha(other: ColorLike, epsilon?: number): boolean;
    equalsWithAlpha(
        r: number,
        g: number,
        b: number,
        a: number,
        epsilon?: number,
    ): boolean;
}

Hierarchy (View Summary)

Implemented by

Properties

a: number
b: number
g: number
r: number

Methods

  • Copy components into array in ARGB order.

    Parameters

    • array: TypedArray

      Typed array

    • Optionaloffset: number

      Optional, offset into array

    • Optionalnormalized: boolean

      Optional, if true copy in range [0,1], otherwise copy in range [0,255] (default)

    Returns void

    Self

  • Copy components into array in RGB order.

    Parameters

    • array: TypedArray

      Typed array

    • Optionaloffset: number

      Optional, offset into array

    • Optionalnormalized: boolean

      Optional, if true copy in range [0,1], otherwise copy in range [0,255] (default)

    Returns void

    Self

  • Copy components into array in RGBA order.

    Parameters

    • array: TypedArray

      Typed array

    • Optionaloffset: number

      Optional, offset into array

    • Optionalnormalized: boolean

      Optional, if true copy in range [0,1], otherwise copy in range [0,255] (default)

    Returns void

    Self

  • Check if the given color components match this color's color components.

    Parameters

    • r: number
    • g: number
    • b: number
    • Optionalepsilon: number

      Optional, epsilon for comparison

    Returns boolean

    Only compares color components, ignores alpha.

  • Check if the color matches this color.

    Parameters

    • other: ColorLike
    • Optionalepsilon: number

      Optional, epsilon for comparison

    Returns boolean

    Compares color components and alpha.

  • Check if the color matches this color.

    Parameters

    • other: ColorLike
    • Optionalepsilon: number

      Optional, epsilon for comparison

    Returns boolean

    Only compares color components, ignores alpha.

  • Check if the given components match this color's components.

    Parameters

    • r: number
    • g: number
    • b: number
    • a: number
    • Optionalepsilon: number

      Optional, epsilon for comparison

    Returns boolean

    Compares color components and alpha.