As per the question title, How could I take a hex code and convert it to a .Net Color object, and do it the other way?
I googled and keep getting the same way which doesn’t work.
ColorTranslator.ToHtml(renderedChart.ForeColor)
Which returns the name of the color as in ‘White’ instead of ‘#ffffff’! Doing it the other way seems to have odd results, only working some of the time…
Something like :
Doing it the other way is a little more complex as #F00 is a valid html color (meaning full red) but it is still doable using regex, here is a small sample class :
Usage :