I want to store Color in string if they are Human Readable format and ToArgb() if they are not.
Color is Red then store it in "Red" string and If color is say some variant of green then it is store as "ff40ff80".
At runtime I want to convert this strings back to Color class Object?
Color color = new Color(0x12345678); String colorString = color. toString(); // Color(0x12345678) String valueString = colorString. split('(0x')[1].
A colour string is a group of premixed piles of paints with different tonal values. You usually start with the darkest colour in the string (say a pure ultramarine blue) and slowly add progressively lighter 'steps' to the mixture.
Solution 1. String backcolor="Red"; cat. BackColor = ColorTranslator. FromHtml(backcolor);
Color color = Color.Red;
string colorName = color.Name; // this gives you the ability to switch back to Color through Color.FromName()
Color sameColor = Color.FromName(colorName);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With