Convert Color Codes with C#

Use the C# library to convert between color formats – RGB, HEX, HSL, HSV, CMYK, LAB, XYZ, etc.

Convert Color Codes Using C#

Aspose.SVG for .NET API offers a high-speed C# library that you can use for different SVG parsing tasks. One of the API features is easy access to work with several color spaces. The Color class allows you to parse colors (such as RGB, HEX, HSL, HWB, CMYK, NCOL, LCH, OKLCH, LAB, OKLAB) from a string representation and convert them to the desired color space. Colors codes and formats play a crucial role in various fields such as web design, graphic design, photography, art and more. Different tasks may require different color formats, hence the need for color conversion functionality.

C# code of HEX to RGB Conversion

The high-speed C# library allows .NET developers to quickly and efficiently convert color codes between popular formats such as HEX, RGB, HSL, HSV, HWB, CMYK, XYZ, LAB, OKLAB, LCH, OKLCH, etc. Color conversion can be done in a few lines of code:

Convert HEX to RGB – C#

// Parse HEX color from a string
var color = Color.FromString("#DEB487");
// Convert HEX to RGB 
string rgbColor = color.ToRgbString();
// Print result to console
//result should be: rgb(222, 180, 135)

SVG Colors in Documentation

Colors codes or color formats are closely linked to the methods of describing and defining colors and are widely used in the web, design, polygraphy, photography, arts, etc. And for different tasks, different color formats are preferred. So, sometimes you may need to convert color formats.

Please visit our documentation to learn more about using Aspose.SVG API functions and consider C# examples for the most common SVG processing scenarios. In the documentation article How to Change SVG Color , you can view how to change the color of elements and background in SVG images using Aspose.SVG for .NET library. The article SVG Color takes an in-depth look at how SVG text and shapes can be colorized. You’ll find an overview of how color is defined, including the various ways you can control the transparency of SVG content.

Online Color Converters

Color Converters are free online web applications that allow you to convert colors between different color codes like RGB, HEX, HSL, HSV, HWB, LAB, CMYK, LCH, XYZ, OKLAB, OKLCH, RGBA, and HSLA on the fly. Color Converters are easy-to-use and work on any browser and operating system. You get the result immediately after entering the color code you need to convert.

Installing Aspose.SVG for .NET library

Aspose.SVG for .NET is a cross-platform flexible library that is designed to provide a wide range of features for processing and rendering SVG documents. It seamlessly integrates into your .NET Apps to work with SVG files without installing any 3rd party software. Our SVG .NET API can be used with any .NET language, such as C#, VB.NET, ASP.NET, etc. It works equally well on any OS that can install Mono (.NET 4.0 Framework support) or use .NET core. This includes Windows, Linux, and macOS.

Installing Aspose.SVG for .NET through NuGet :

  1. Using the Package Manager Console.
  2. Using the NuGet Package Manager GUI.

For more details about C# library installation, please refer to Aspose.SVG Documentation .

Other Supported Color Converters