Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matching hex values to System.Drawing.Color

Status
Not open for further replies.

Craftor

Programmer
Feb 1, 2001
420
NZ
Hi all

I am trying to create a color picker based on the "safe" internet colors (roughly 216). I'd like to try and match these hex values to the System.Drawing.KnownColor enumerations e.g. #FFFFFF easily maps to White. I know there will be a couple that won't match up (KnownColor has about 168 enums I think) - but that's not a problem, I'd just like to match those I can.

There doesn't seem to be any clear map between these - the Color.FromHtml() doesn't return anything near the result I want - and even trying to create a System.Drawing.Color from the RGB values (using int.Parse to get from hex to int) doesn't work.

Does anyone have any ideas as to how I'd go about this?

Thanks as always

Craftor
:cool:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top