Online Color Converter
If you need to convert colors from one color model to another, use our free online tool! It supports various color spaces, including HEX, RGB, CMYK, HSL, LAB, NCOL, XYZ, etc. You simply need to enter the color value for conversion! Click inside the color area to select a color, or enter a color code in the Input text box. You will immediately see other color codes for chosen color in the Output section.
// Parse HSL color from a string
Color color = Color.FromString("hsl(31.034, 57%, 70%)");
// Convert HSL to RGB
string rgbColor = color.ToRgbString();
// Print the result to console
Console.WriteLine(rgbColor);
//result should be: rgb(222, 180, 134)
Convert HSL to RGB 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.
HSL to RGB: Code Walkthrough
If you want to use the conversion functions in your product or programmatically convert HSL to RGB, see the C# code example above. Color conversion can be done with a few lines of code:
- The
Color.FromString(“hsl(31.034, 57%, 70%)”)
method is used to parse the HSL color code from its string representation and returns a
colorinstance. - The color.ToRgbString() method converts the color from HSL to the RGB color space. The format is: rgb(0,0,0).
- The result of the RGB color value is printed to the console using
Console.WriteLine(rgbColor).
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.
FAQ
RGB and HEX are designed for digital screens and web development. HSL and HWB are convenient for manual color adjustment. CMYK is intended for print, while LAB, LCH, OKLCH, and OKLAB are perceptual color models that better align with human vision. The choice of color space depends on the specific task – whether it’s web design, UI/UX, printing, or modern CSS. Understanding these differences is essential for accurate color conversion across various color spaces.
Within the same color space family (for example, RGB ↔ HEX or HSL ↔ HWB), the result is completely identical with no loss of quality. When converting between fundamentally different color spaces (such as RGB ↔ CMYK or RGB ↔ LAB/OKLAB), slight visual differences may appear due to varying color gamuts. Aspose.SVG uses high-precision mathematics to deliver the most accurate color conversion possible across different color spaces.
You can convert between a wide range of color models, including RGB, HEX, HSL, HSV, HWB, CMYK, LAB, LCH, OKLAB, OKLCH, RGBA, HSLA, XYZ, NCOL, and others.
Yes. Aspose.SVG for .NET is built on .NET Standard 2.0, making it compatible with .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5/6/7/8+. The same conversion code runs without modification across any supported runtime.
What is HSL Color?
HSL (Hue, Saturation, Lightness) is a representation of the RGB color model in cylindrical coordinates. Hue is any color on the color wheel; it’s a degree on the color wheel from 0 to 360. So, 0 is red, 120 is green, 240 is blue. Saturation is the intensity or purity of a color. It determines how vivid the color will be. For example, zero percent is gray, and 100 percent is a fully saturated color. Lightness is the amount of brightness or light in color. Lightness determines how much black or white tint the color has. For example, 50 percent has no tint, zero percent is entirely black, and 100 percent is fully white.
What is RGB Color?
The RGB (Red, Green, Blue) color space consists of all possible colors that can be obtained by mixing red, green, and blue. This color model is popular in photography, TV and computer graphics. RGB values are specified as an integer between 0 and 255. So, for example, rgb(255,0,0) is displayed as red. The red parameter is set to its highest value (255), and the rest are set to 0.
Aspose.SVG C# library supports RGB percentages (from 0% to 100%). For example, rgb(100%,0,0) is displayed as red.
Get Started with Aspose.SVG for .NET API
If you are interested in developing scalable vector graphics and their application, install our flexible, high-speed Aspose.SVG for .NET API with a powerful set of interfaces for C# and other .NET programming languages.
Install from command line as nuget install Aspose.SVG or via Package Manager Console of Visual Studio with Install-Package Aspose.SVG.
Alternatively, get the offline MSI installer or DLLs in a ZIP file from
downloads.
Aspose.SVG for .NET API is a standalone library and does not depend on any software for SVG document processing.
For more details about C# library installation and system requirements, please refer to
Aspose.SVG Documentation.