Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Color from hex in ASP.NET Core

How can I get Color from hex value in ASP.NET Core?

I found Color class in System.Drawing namespace, but no appropriate method FromHex.

I need to convert values like:

#F3A
#2F3682
#83A7B278
like image 589
Makla Avatar asked Dec 07 '22 16:12

Makla


1 Answers

I found that corefx contains System.Drawing.Common, so you can use

Color col = ColorTranslator.FromHtml("#FFCC66");

Source code can be found here: GitHub

like image 102
Leonid Avatar answered Jan 21 '23 08:01

Leonid