C# Color Object

The C# Color Object is a very convenient way of storing colors in your C# projects. Once you have a Color object you can easily get the RGB and HSB values out of it. Understanding the Color object is important if you are learning to do any C# work that involves colors.

Creating Color Objects

If you have an HTML color code and you want to make a Color object then you may want to read about how to Create C# Color Objects from HTML Color Codes.

The easiest way to create a Color object is from a known color.

If you happen to have the color that you need in a string you can specify it that way as well.

If you need to test if the color returned is valid you can look at the alpha channel. It will be 0 for a bad color name.

If you want to translate a typed in color string to a proper known color value you can do that too.

C# Color Object

Once you have a Color object you can get the individual Red, Green, and Blue components as well as the Alpha (transperancy).

If you need to be in the HSB (Hue, Saturation, Brightness) gamut it’s just as easy.

C# Image Processing

Be sure to check out our other C# Image Processing Guides located here.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.