The Color struct represents a color using four floating-point values (red, green, blue, and alpha) within a 0-1 range. It 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) within a 0-1 range. It 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 an RGB integer. |
FromRgba | Creates a color from an RGBA integer. |
Parse | Parses a string to a color. |
TryParse | Tries to parse a string to a color. |
Random | Returns a random color from a set of preset colors. |
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. |
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, keeping alpha unchanged. |
Desaturate | Desaturates the color by a specified fraction. |
Saturate | Saturates the color by a specified fraction. |
ComponentCountChangedBetweenColors | Checks the component count change between two colors. |
Property Name | Summary |
---|---|
Luminance | Returns the grayscale value 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 "#RRGGBB[AA]" format. |
Rgba | String representation in CSS rgba function notation. |
Rgb | String representation in CSS rgb function notation. |
RgbaInt | Integer representation in 0xRRGGBBAA format. |
RgbInt | Integer representation in 0xRRGGBB format. |
RawInt | Integer representation in 0xAABBGGRR format. |
Item | Accesses color components by index. |
Field Name | Summary |
---|---|
r | The red component, can exceed 0-1 range. |
g | The green component, can exceed 0-1 range. |
b | The blue component, can exceed 0-1 range. |
a | The alpha component, can exceed 0-1 range. |
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. |