rapid-render
    Preparing search index...

    Class Color

    Represents a color with red, green, blue, and alpha (transparency) components.

    Implements

    Index

    Constructors

    • Creates an instance of Color.

      Parameters

      • r: number

        The red component (0-255).

      • g: number

        The green component (0-255).

      • b: number

        The blue component (0-255).

      • a: number = 255

        The alpha component (0-255).

      Returns Color

    Properties

    uint32: number
    Black: Color = ...
    Blue: Color = ...
    Brown: Color = ...
    Cyan: Color = ...
    Gray: Color = ...
    Green: Color = ...
    Lime: Color = ...
    Magenta: Color = ...
    Orange: Color = ...
    Pink: Color = ...
    Purple: Color = ...
    Red: Color = ...
    TRANSPARENT: Color = ...
    White: Color = ...
    Yellow: Color = ...

    Accessors

    • get a(): number

      Gets the alpha component.

      Returns number

    • set a(value: number): void

      Sets the alpha component and updates the uint32 representation.

      Parameters

      • value: number

        The new alpha component (0-255).

      Returns void

    • get b(): number

      Gets the blue component.

      Returns number

    • set b(value: number): void

      Sets the blue component and updates the uint32 representation.

      Parameters

      • value: number

        The new blue component (0-255).

      Returns void

    • get g(): number

      Gets the green component.

      Returns number

    • set g(value: number): void

      Sets the green component and updates the uint32 representation.

      Parameters

      • value: number

        The new green component (0-255).

      Returns void

    • get r(): number

      Gets the red component.

      Returns number

    • set r(value: number): void

      Sets the red component and updates the uint32 representation.

      Parameters

      • value: number

        The new red component (0-255).

      Returns void

    Methods

    • Adds the components of another color to this color, clamping the result to 255.

      Parameters

      • color: Color

        The color to add.

      Returns Color

      A new Color instance with the result of the addition.

    • Returns void

    • Clone the current color

      Returns Color

      A new Color instance with the same RGBA values.

    • Copies the RGBA values from another color.

      Parameters

      • color: Color

        The color to copy from.

      Returns void

    • Parameters

      Returns Color

    • Checks if the current color is equal to another color.

      Parameters

      • color: Color

        The color to compare with.

      Returns boolean

      True if the colors are equal, otherwise false.

    • Parameters

      Returns Color

    • Sets the RGBA values of the color and updates the uint32 representation.

      Parameters

      • r: number

        The red component (0-255).

      • g: number

        The green component (0-255).

      • b: number

        The blue component (0-255).

      • a: number

        The alpha component (0-255).

      Returns void

    • Subtracts the components of another color from this color, clamping the result to 0.

      Parameters

      • color: Color

        The color to subtract.

      Returns Color

      A new Color instance with the result of the subtraction.

    • Creates a Color instance from a hexadecimal color string.

      Parameters

      • hexString: string

        The hexadecimal color string, e.g., '#RRGGBB' or '#RRGGBBAA'.

      Returns Color

      A new Color instance.