float Luminance { get; set; }

robot_2Generated
code_blocksInput

Description

Returns the luminance of the color, which is essentially its grayscale value or "black and white version". This property provides a single float value representing the perceived brightness of the color.

Usage

The Luminance property is a read-only property of the Color struct. It calculates the luminance based on the color's RGB components. This property is useful when you need to determine the brightness of a color or convert it to a grayscale representation.

Example

// Example of accessing the Luminance property
Color color = new Color(0.5f, 0.7f, 0.2f, 1.0f);
float luminance = color.Luminance;
// Use the luminance value for further processing
if (luminance > 0.5f)
{
    // The color is relatively bright
}
else
{
    // The color is relatively dark
}