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
    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

    • 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

    • Creates a copy of this color.

      Returns IMutableColorRgb

      A new mutable color instance with the same values

    • Copies components from another vector.

      Parameters

      • vec: IVector3

        The source vector to copy from

      Returns IMutableColorRgb

      This color instance for method chaining

    • Calculates the cross product with another vector.

      Parameters

      • vec: IVector3

        The vector to calculate cross product with

      Returns IMutableColorRgb

      This color instance for method chaining

    • Divides this color by a scalar value.

      Parameters

      • value: number

        The scalar value to divide by

      Returns IMutableColorRgb

      This color instance for method chaining

    • Divides this color by another vector component-wise.

      Parameters

      Returns IMutableColorRgb

      This color instance for method chaining

    • Calculates the dot product with another vector.

      Parameters

      • vec: IVector3

        The vector to calculate dot product with

      Returns number

      The dot product result

    • 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

    • Calculates the distance to another vector.

      Parameters

      Returns number

      The distance to the target vector

    • Multiplies this color by a scalar value.

      Parameters

      • value: number

        The scalar value to multiply by

      Returns IMutableColorRgb

      This color instance for method chaining

    • Multiplies this color by another vector component-wise.

      Parameters

      • vec: IVector3

        The vector to multiply by

      Returns IMutableColorRgb

      This color instance for method chaining

    • Normalizes the color vector to unit length.

      Returns IMutableColorRgb

      This color instance for method chaining

    • Gets the raw typed array representation of the color data.

      Returns TypedArray

      The underlying typed array containing color components

    • Sets the value of a component at the specified index.

      Parameters

      • i: number

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

      • value: number

        The new value for the component

      Returns IMutableColorRgb

      This color instance for method chaining

    • 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