---
title: "how to convert html color to rgb in c#?"  
description: "how to convert html color to rgb in c#?"  
author: "Pravesh Singh"  
published: 2012-07-16  
updated: 2012-07-21  
canonical: https://www.mindstick.com/forum/425/how-to-convert-html-color-to-rgb-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# how to convert html color to rgb in c#?

Hi,

Can [anyone tell me](https://www.mindstick.com/interview/23033/can-anyone-tell-me-about-hadoop-toolbox) how to [convert](https://www.mindstick.com/forum/2093/configurationmanager-appsettings-convert-n-to-n-why) [html](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript) [color](https://www.mindstick.com/articles/77/how-to-split-form-background-color-in-c-sharp) to rgb in c#. Please give the [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) if possible.

## Replies

### Reply by Anonymous User

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");


---

Original Source: https://www.mindstick.com/forum/425/how-to-convert-html-color-to-rgb-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
