I want to create a System.Drawing.Color
from a value like #FF00FF
or FF00FF
without needing to write code for that. There is any .NET built-in parser for that?
Get the 2 left digits of the hex color code and convert to decimal value to get the red color level. Get the 2 middle digits of the hex color code and convert to decimal value to get the green color level. Get the 2 right digits of the hex color code and convert to decimal value to get the blue color level.
ColorTranslator.FromHtml("#FF00FF");
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