ColorRGBa
Represents a color in the RGBA color space. Each component, includingC, green, blue, and alpha (opacity), is represented as a Double in the range [0.0, 1.0]. The color can be defined in linear, sRGB or Display P3 space, determined by the linearity property.
This class provides a wide variety of utility functions for manipulating and converting colors, such as shading, opacity adjustment, and format transformations. It also includes methods for parsing colors from hexadecimal notation or vectors.
Constructors
Types
Properties
Returns a new instance of ColorRGBa where the red, green, and blue components are multiplied by the alpha value of the original color. The alpha value and linearity remain unchanged.
Indicates whether the color is defined in linear, sRGB or Display P3 space. Defaults to Linearity.LINEAR.
calculate luminance value luminance value is according to https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
Functions
calculate the contrast value between this color and the given color contrast value is accordingo to // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
Convert to linear, with the sRGB primaries. Colors outside of the sRGB gamut, such as Linearity.DISPLAY_P3 colors, have components below 0 or above 1.
Converts this color to the specified linearity.