Tip Of the Day – Converting string to System.Color

Posted on

Hi I’d like to start publishing “c# tip’s of the day” posts which will contain small trivial(or may be not) C# snippets which searched or looked today.
Today’s tip will be  – how to parse Color from HEX string. Hex colors are commonly user in web css styles and System.Color didn’t provide direct access to method allowing to parse color from string.
   1: string xCol = "#FF00DD";
   2: Color c = System.Drawing.ColorTranslator.FromHtml(xCol);