I have a color hex string stored in the database like 0x78dce6b0
; I can convert this to an ARGB color using:
string colorString=0x78dce6b0;
int hexColor = Convert.ToInt32(colorString ?? "0", 16);
Color colorTL = Color.FromArgb(hexColor);
Now I want to convert this to use in an HTML page, so I need to convert into an HTML value like #cc3388
. If I directly convert using ColorTranslator.ToHtml(colorTL)
, I lose the alpha blending value. How do I convert it by taking into consideration the alpha value, assuming the background is always white?
HTML Colors do not have an Alpha
component.
Unfortunately it is impossible to convert ARGB
to HTML RGB
without losing the Alpha
component.
If you want to blend your color with white, based upon your alpha value...