Description
The Invert
method of the Color
struct returns a new Color
instance with the RGB components inverted. The alpha component remains unchanged. This method is useful for creating complementary colors or for visual effects where an inverted color scheme is desired.
Usage
To use the Invert
method, call it on an instance of the Color
struct. The method does not take any parameters and returns a new Color
object with inverted RGB values.
Example
// Example of using the Invert method
Color originalColor = new Color(0.2f, 0.4f, 0.6f, 1.0f);
Color invertedColor = originalColor.Invert();
// originalColor: (0.2, 0.4, 0.6, 1.0)
// invertedColor: (0.8, 0.6, 0.4, 1.0)