-
Can SkiaSharp convert the color name to the corresponding HEX? By var color = Color.FromName("blue");
var argb = color.ToArgb();
var colorHex = $"{argb:x6}"; but I can't find similar in SkiaSharp. |
Beta Was this translation helpful? Give feedback.
Answered by
ashahabov
Sep 12, 2022
Replies: 2 comments 6 replies
-
ToString maybe? Or just cast to uint. |
Beta Was this translation helpful? Give feedback.
5 replies
-
Found solution via reflection: var inputClrName = "blue";
var fieldInfo = typeof(SKColors).GetFields(BindingFlags.Static | BindingFlags.Public)
.First(fieldInfo => fieldInfo.Name.ToLower() == inputClrName);
var color = (SKColor)fieldInfo.GetValue(null);
var outputHexString = color.ToString(); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
mattleibow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Found solution via reflection: