View ColorCodeTransform
public static string ToHexadecimalColorCode(string color) | |
{ | |
Color baseColor = ColorTranslator.FromHtml(color); | |
// if its a named color we can use the argb value to transform it to a hex | |
var argb = baseColor.ToArgb(); | |
return ColorTranslator.ToHtml(Color.FromArgb(argb)); | |
} |