Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active October 12, 2022 16:10
Convert HEX to RGB RGBA Color Code in C#
// Parse HEX color from a string
Aspose.Svg.Drawing.Color color = Aspose.Svg.Drawing.Color.FromString("#DEB487");
// Convert HEX to RGB
string rgbColor = color.ToRgbString();
// Print the result into console
Console.WriteLine("RGB: " + rgbColor);
// Parse HEX color from a string
Aspose.Svg.Drawing.Color color = Aspose.Svg.Drawing.Color.FromString("#DEB487");
// Convert HEX to RGBA
String rgba = color.ToRgbaString();
// Print the result into console
Console.WriteLine("RGBA: " + rgba);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment