RSX Code Reference
    Preparing search index...

    Class SRGBColor

    The SRGBColor implements a color in SRGB color space. The class follows the 'copy-on-write' pattern, which means that every operation such as SRGBColor.divideScalar or SRGBColor.multiply returns a copy of the color with updated values. It also implies that the values of the color cannot be directly modified.

    The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.

    Index
    • Parameters

      • Optionalr: number
      • Optionalg: number
      • Optionalb: number
      • Optionala: number

      Returns SRGBColor

    _a: number
    _b: number
    _g: number
    _r: number
    • get a(): number

      Returns number

    • set a(value: number): void

      Parameters

      • value: number

      Returns void

    • get b(): number

      Returns number

    • set b(value: number): void

      Parameters

      • value: number

      Returns void

    • get elementCount(): number

      Gets the number of elements in this color.

      Returns number

    • get g(): number

      Returns number

    • set g(value: number): void

      Parameters

      • value: number

      Returns void

    • get r(): number

      Returns number

    • set r(value: number): void

      Parameters

      • value: number

      Returns void

    • get lightBlue(): SRGBColor

      Light blue SRGBcolor with solid alpha value.

      Returns SRGBColor

    • get magenta(): SRGBColor

      Pure magenta SRGBcolor with solid alpha value.

      Returns SRGBColor

    • Clones this instance and returns a new SRGBColor with identical values.

      Returns SRGBColor

    • Returns a copy of the current color divided by a factor.

      Parameters

      • factor: number

      Returns SRGBColor

    • Divides this color by a factor.

      Parameters

      • factor: number

      Returns SRGBColor

    • Performs scalar multiplication of this color and returns it.

      Parameters

      • factor: number
      • multiplyAlpha: boolean

      Returns SRGBColor

    • Sets the alpha value to the specified value.

      Parameters

      • alpha: number

      Returns SRGBColor

    • Accesses color components by an index.

      Parameters

      • index: number

        Index ranging [0, 3]

      Returns number

      Value of the component at the specified index.

    • Returns whether the provided color, given a error margin, has the same color components values as this one.

      Parameters

      • rhs: Immutable<SRGBColor>

        The other Color to compare with.

      • Optionalepsilon: number

        Optional. Error margin within which the numbers should be considered equal.

      Returns boolean

      True if equal, false otherwise.

    • Returns whether the given color contains the same color components values as this one.

      Parameters

      Returns boolean

    • Returns a copy of this color multiplied by the factor.

      Parameters

      • factor: number
      • multiplyAlpha: boolean

      Returns SRGBColor

    • Returns a copy of this color with the specified alpha value.

      Parameters

      • alpha: number

      Returns SRGBColor

    • Assigns the value to the element at the specified index.

      Parameters

      • index: number
      • value: number

      Returns void

    • Converts the current color to a Color.

      Returns Color

      No colorspace conversion is performed.

    • Converts the current color from SRGB to linear space and returns the result.

      Returns LinearColor

    • Returns a string representation of an object.

      Returns string

    • Converts this instance to a Vector3 with R/G/B while ignoring the alpha value.

      Returns Vector3

    • Compares two colors with an error margin.

      Parameters

      • lhs: Immutable<SRGBColor>

        First color to compare.

      • rhs: Immutable<SRGBColor>

        Second color to compare.

      • Optionalepsilon: number

        Optional. Error margin within which the numbers should be considered equal.

      Returns boolean

      True if equal, false otherwise.

    • Creates a color from the specified RGBA byte values in range [0-255].

      Parameters

      • Optionalr: number
      • Optionalg: number
      • Optionalb: number
      • Optionala: number

      Returns SRGBColor