Optionalr: numberOptionalg: numberOptionalb: numberOptionala: numberProtected_Protected_Protected_Protected_Gets the number of elements in this color.
StaticblackSRGBColor with all elements set to 0.
StaticbluePure blue SRGBcolor with solid alpha value.
StaticcyanPure cyan SRGBcolor with solid alpha value.
StaticdarkStaticdarkStaticgreenPure green SRGBcolor with solid alpha value.
StaticlightLight blue SRGBcolor with solid alpha value.
StaticlightStaticmagentaPure magenta SRGBcolor with solid alpha value.
StaticmediumStaticorangeStaticredPure red SRGBcolor with solid alpha value.
StatictransparentStaticveryStaticveryStaticwhiteSRGBColor with all elements set to 1.
StaticyellowPure yellow SRGBcolor with solid alpha value.
Clones this instance and returns a new SRGBColor with identical values.
Returns a copy of the current color divided by a factor.
Performs scalar multiplication of this color and returns it.
Accesses color components by an index.
Index ranging [0, 3]
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.
True if equal, false otherwise.
Returns a copy of this color multiplied by the factor.
Returns a copy of this color with the specified alpha value.
Assigns the value to the element at the specified index.
Converts this color to a HueSaturationValue color.
Converts the current color from SRGB to linear space and returns the result.
Returns a string representation of an object.
StaticaddStaticdivideStaticisCompares two colors with an error margin.
True if equal, false otherwise.
StaticisStaticlerpStaticmultiplyStaticmultiplyStaticsubtractStaticwithCreates a color from the specified RGBA byte values in range [0-255].
Optionalr: numberOptionalg: numberOptionalb: numberOptionala: numberStaticwithStaticwithStaticwith
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.