Introduction
This method accepts a System.Drawing.Color object and uses the RGB values to create and return an object representing the color's inversion.
public static Color Invert (this Color color)
{
return Color.FromArgb(255 - color.R, 255 - color.G, 255 - color.B);
}
In this example the method is static and is an extension method so you can call it like so:
Color redInverted = Color.Red.Invert();