rhodonite
    Preparing search index...

    Interface IMutableColorRgb

    Mutable RGB color interface with alpha channel support. Represents a color with red, green, blue components and readonly alpha. RGB components can be modified, but alpha remains readonly.

    interface IMutableColorRgb {
        a: number;
        b: number;
        g: number;
        r: number;
        add(vec: IVector3): IMutableColorRgb;
        at(i: number): number;
        clone(): IMutableColorRgb;
        copyComponents(vec: IVector3): IMutableColorRgb;
        cross(vec: IVector3): IMutableColorRgb;
        divide(value: number): IMutableColorRgb;
        divideVector(vec: IVector3): IMutableColorRgb;
        dot(vec: IVector3): number;
        flattenAsArray(): number[];
        isDummy(): boolean;
        isEqual(vec: IVector3, delta: number): boolean;
        isStrictEqual(vec: IVector3): boolean;
        length(): number;
        lengthSquared(): number;
        lengthTo(vec: IVector3): number;
        multiply(value: number): IMutableColorRgb;
        multiplyVector(vec: IVector3): IMutableColorRgb;
        normalize(): IMutableColorRgb;
        one(): IMutableColorRgb;
        raw(): TypedArray;
        setAt(i: number, value: number): IMutableColorRgb;
        setComponents(x: number, y: number, z: number): IMutableColorRgb;
        subtract(vec: IVector3): IMutableColorRgb;
        toString(): string;
        toStringApproximately(): string;
        zero(): IMutableColorRgb;
    }

    Implemented by

    Index

    Properties

    a: number

    Alpha (transparency) component of the color (0.0 to 1.0) - readonly

    b: number

    Blue component of the color (0.0 to 1.0) - mutable

    g: number

    Green component of the color (0.0 to 1.0) - mutable

    r: number

    Red component of the color (0.0 to 1.0) - mutable

    Methods

    • Gets the component value at the specified index.

      Parameters

      • i: number

        The index (0=r, 1=g, 2=b, 3=a)

      Returns number

      The component value at the specified index

    • Converts the color to a flat array of numbers.

      Returns number[]

      Array containing the color components

    • Checks if this is a dummy/placeholder color instance.

      Returns boolean

      True if this is a dummy color, false otherwise

    • Checks if this color is equal to another vector within a given tolerance.

      Parameters

      • vec: IVector3

        The vector to compare with

      • delta: number

        The tolerance for comparison

      Returns boolean

      True if the colors are equal within the tolerance

    • Checks if this color is strictly equal to another vector.

      Parameters

      • vec: IVector3

        The vector to compare with

      Returns boolean

      True if the colors are exactly equal

    • Calculates the length (magnitude) of the color vector.

      Returns number

      The length of the color vector

    • Calculates the squared length of the color vector.

      Returns number

      The squared length of the color vector

    • Sets the RGB components of the color.

      Parameters

      • x: number

        The red component value

      • y: number

        The green component value

      • z: number

        The blue component value

      Returns IMutableColorRgb

      This color instance for method chaining

    • Returns a string representation of the color.

      Returns string

      String representation of the color

    • Returns an approximate string representation of the color with limited precision.

      Returns string

      Approximate string representation of the color