Tim Van Wassenhove

Passionate geek, interested in Technology. Proud father of two

17 Apr 2007

Get hexadecimal RGB value from System.Drawing.Color

Here’s a simple function that returns the hexadecimal RGB value of a System.Drawing.Color

private string ToHexadecimalRgb(Color color)
{
	return color.ToArgb().ToString("X").Substring(2);
}

EDIT Apparently there is also a ColorTranslator with methods ToHtml and FromHtml.