From 05f2ec475d65d004a9a5d471e27464f3c9c300f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Sun, 14 Mar 2021 02:03:46 +0100 Subject: [PATCH] color conversion debug --- Crow/src/Colors.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.47.3