Description
The Alpha
property of the ColorHsv
struct represents the transparency level of the color. It is a floating-point value ranging from 0 to 1, where 0 indicates full transparency (completely invisible) and 1 indicates full opacity (completely visible).
Usage
To get or set the transparency of a ColorHsv
instance, use the Alpha
property. This property is useful when you need to adjust the visibility of a color in your application.
Example
// Create a ColorHsv instance with full opacity
ColorHsv color = new ColorHsv { Hue = 120, Saturation = 0.5f, Value = 0.75f, Alpha = 1.0f };
// Change the alpha to make the color semi-transparent
color.Alpha = 0.5f;
// Access the alpha value
float currentAlpha = color.Alpha;
// Output: 0.5
// This indicates the color is now semi-transparent