Description
The r
field of the Color
struct represents the red component of a color. It is a float
value that typically ranges from 0 to 1, where 0 indicates no red and 1 indicates full red. However, this value can exceed 1, allowing for high dynamic range (HDR) color representations.
Usage
To access or modify the red component of a Color
instance, you can directly use the r
field. This is useful when you need to adjust the red intensity of a color or when you are constructing a color programmatically.
Example
// Example of accessing and modifying the red component of a Color
Color myColor = new Color();
myColor.r = 0.5f; // Set the red component to 50%
// Accessing the red component
float redValue = myColor.r;
// Example of exceeding the typical range
myColor.r = 1.5f; // Set the red component to 150% for HDR