Hi Pravesh Singh, You can use this code to resolve your problem.... using System.Drawing; using System; //convert to the HTML color value of a known System.Drawing.Color string htmlNamedColorValue = ColorTranslator.ToHtml(Color.Crimson); //convert to System.Drawing.Color from HTML hex color value Color colorValueFrmHex = ColorTranslator.FromHtml("#FFFF33"); //convert to System.Drawing.Color from HTML known color Color colorValue = ColorTranslator.FromHtml("DarkRed");
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
You can use this code to resolve your problem....
using System.Drawing;
using System;
//convert to the HTML color value of a known System.Drawing.Color
string htmlNamedColorValue = ColorTranslator.ToHtml(Color.Crimson);
//convert to System.Drawing.Color from HTML hex color value
Color colorValueFrmHex = ColorTranslator.FromHtml("#FFFF33");
//convert to System.Drawing.Color from HTML known color
Color colorValue = ColorTranslator.FromHtml("DarkRed");