The Color struct represents a color using four floating-point values (red, green, blue, and alpha) each ranging from 0 to 1. This struct provides various methods and properties to manipulate and retrieve color information.
The Color struct represents a color using four floating-point values (red, green, blue, and alpha) each ranging from 0 to 1. This struct provides various methods and properties to manipulate and retrieve color information.
Member Name | Summary |
---|---|
Min | Returns the minimum color between two colors. |
Max | Returns the maximum color between two colors. |
Average | Calculates the average color from an array of colors. |
Lerp | Linearly interpolates between two colors. |
FromBytes | Creates a color from byte values. |
FromRgb | Creates a color from a 32-bit RGB value. |
FromRgba | Creates a color from a 32-bit RGBA value. |
Parse | Parses a color from a string. |
TryParse | Tries to parse a color from a string. |
Random | Returns a random color from a set of preset colors. |
White | Fully opaque white color. |
Gray | Fully opaque gray color. |
Black | Fully opaque black color. |
Red | Fully opaque red color. |
Green | Fully opaque green color. |
Blue | Fully opaque blue color. |
Yellow | Fully opaque yellow color. |
Orange | Fully opaque orange color. |
Cyan | Fully opaque cyan color. |
Magenta | Fully opaque magenta color. |
Transparent | Fully transparent color. |
Member Name | Summary |
---|---|
WithAlpha | Returns a new color with the specified alpha value. |
WithAlphaMultiplied | Returns a new color with the alpha value multiplied by a factor. |
WithRed | Returns a new color with the specified red value. |
WithGreen | Returns a new color with the specified green value. |
WithBlue | Returns a new color with the specified blue value. |
ToHsv | Converts this color to HSV format. |
ToColor32 | Converts this color to a 32-bit color. |
LerpTo | Interpolates this color towards a target color. |
AdjustHue | Adjusts the hue of the color by a specified amount. |
Darken | Darkens the color by a specified fraction. |
Lighten | Lightens the color by a specified fraction. |
Invert | Returns the inverted color. |
Desaturate | Desaturates the color by a specified fraction. |
Saturate | Saturates the color by a specified fraction. |
ComponentCountChangedBetweenColors | Returns the number of components that changed between two colors. |
Luminance | Returns the luminance of the color. |
IsRepresentableInHex | Indicates if the color can be represented in hexadecimal format. |
IsSdr | Indicates if all components are between 0 and 1. |
IsHdr | Indicates if any component exceeds 1. |
Hex | String representation in hexadecimal format. |
Rgba | String representation in CSS rgba format. |
Rgb | String representation in CSS rgb format. |
RgbaInt | Integer representation in RGBA format. |
RgbInt | Integer representation in RGB format. |
RawInt | Integer representation in native format. |
Item | Accesses the color component by index. |
r | The red color component. |
g | The green color component. |
b | The blue color component. |
a | The alpha color component. |