Optionalr: numberOptionalg: numberOptionalb: numberOptionala: numberProtected_Protected_Protected_Protected_Static ReadonlycompareThe default value to approximately compare colors,
Gets the number of elements in this color.
StaticblackColor with all elements set to 0.
StaticbluePure blue color with solid alpha value.
StaticcyanPure cyan color with solid alpha value.
StaticdarkStaticdarkStaticgreenPure green color with solid alpha value.
StaticlightLight blue color with solid alpha value.
StaticlightStaticmagentaPure magenta color with solid alpha value.
StaticmediumStaticorangeStaticredPure red color with solid alpha value.
StatictransparentStaticveryStaticveryStaticwhiteColor with all elements set to 1.
StaticyellowPure yellow color with solid alpha value.
Clones this instance and returns a new Color with identical values.
Adds another color to this one and returns it.
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.
Converts the current color from linear to sRGB and returns the result.
Converts the current color from sRGB to linear space and returns the result.
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.
Assigns the value to the element at the specified index.
Converts this color to a HueSaturationValue color.
Converts this instance to a LinearColor.
No colorspace conversion is performed. If a colorspace conversion is required, use toSRGB first and then SRGBColor#toLinear.
Converts this instance to a SRGBColor.
No colorspace conversion is performed. If a colorspace conversion is required, use toLinear first and then LinearColor#toSRGB.
Returns a string representation of an object.
StaticaddStaticconvertConverts a single color component from linear to SRGB.
Component in linear space.
Component in SRGB space.
StaticconvertConverts a single color component from SRGB to linear space.
Component in SRGB space.
Component in linear space.
StaticdivideStaticisStaticisStaticlerpStaticmultiplyStaticmultiplyStaticsubtractStaticwithCreates a color from the specified RGBA byte values in range [0-255].
Optionalr: numberOptionalg: numberOptionalb: numberOptionala: numberStaticwithStaticwith
The Color implements a a three-component color with an alpha component. The class follows the 'copy-on-write' pattern, which means that every operation such as Color.add or Color.subtract 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.