From: Jean-Philippe Bruyère Date: Sun, 14 Mar 2021 01:03:46 +0000 (+0100) Subject: color conversion debug X-Git-Tag: v0.9.5-beta~63 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=05f2ec475d65d004a9a5d471e27464f3c9c300f3;p=jp%2Fcrow.git color conversion debug --- diff --git a/Crow/src/Colors.cs b/Crow/src/Colors.cs index 5b4396f7..ba2ad7e8 100644 --- a/Crow/src/Colors.cs +++ b/Crow/src/Colors.cs @@ -352,7 +352,9 @@ namespace Crow public static Color Parse(string s) => string.IsNullOrEmpty (s) ? new Color (Colors.White) : - s[0] == '#' ? new Color (UInt32.Parse (s.AsSpan().Slice (1), System.Globalization.NumberStyles.HexNumber)) : + s[0] == '#' ? s.Length < 8 ? + new Color (0xff + (UInt32.Parse (s.AsSpan ().Slice (1), System.Globalization.NumberStyles.HexNumber)<<8)) + : new Color (UInt32.Parse (s.AsSpan().Slice (1), System.Globalization.NumberStyles.HexNumber)) : char.IsDigit(s[0]) ? FromIml (s) : FastEnum.TryParse (s, out Colors cc) ? new Color(cc) : throw new Exception ("Unknown color name: " + s);