This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
} |