For example:
blue
converts to:
#0000FF
I wrote it as:
Color color = Color.FromName("blue");
But I don't know how to get the hexadecimal representation.
You're half way there. Use .ToArgb to convert it to it's numberical value, then format it as a hex value.
.ToArgb
int ColorValue = Color.FromName("blue").ToArgb(); string ColorHex = string.Format("{0:x6}", ColorValue);
2.1m questions
2.1m answers
60 comments
57.0k users