From ad3cf944b6bea1b29c1b000182867f9c69a9ccd3 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Wed, 31 Aug 2022 12:04:45 +0200 Subject: [PATCH] Add Grey color overloads (#9788) Fixes #2170 --- src/SingleProject/Resizetizer/src/ColorTable.cs | 12 ++++++++++++ .../Resizetizer/test/UnitTests/UtilsTests.cs | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/SingleProject/Resizetizer/src/ColorTable.cs b/src/SingleProject/Resizetizer/src/ColorTable.cs index 8ff255d7a869..ab7a7fc94181 100644 --- a/src/SingleProject/Resizetizer/src/ColorTable.cs +++ b/src/SingleProject/Resizetizer/src/ColorTable.cs @@ -15,7 +15,19 @@ static class ColorTable static Dictionary GetColors() { var colors = new Dictionary(StringComparer.OrdinalIgnoreCase); + + // add from SKColors fields FillWithProperties(colors, typeof(SKColors)); + + // add "grey" (with an "e") overloads + colors.Add("DarkGrey", colors["DarkGray"]); + colors.Add("DarkSlateGrey", colors["DarkSlateGray"]); + colors.Add("DimGrey", colors["DimGray"]); + colors.Add("Grey", colors["Gray"]); + colors.Add("LightGrey", colors["LightGray"]); + colors.Add("LightSlateGrey", colors["LightSlateGray"]); + colors.Add("SlateGrey", colors["SlateGray"]); + return colors; } diff --git a/src/SingleProject/Resizetizer/test/UnitTests/UtilsTests.cs b/src/SingleProject/Resizetizer/test/UnitTests/UtilsTests.cs index 68505f71a077..2639f477f9a0 100644 --- a/src/SingleProject/Resizetizer/test/UnitTests/UtilsTests.cs +++ b/src/SingleProject/Resizetizer/test/UnitTests/UtilsTests.cs @@ -23,6 +23,10 @@ public void ParsesHexValues(string hex, uint argb) [InlineData("Red", 0xFFFF0000)] [InlineData("Green", 0xFF008000)] [InlineData("Blue", 0xFF0000FF)] + [InlineData("Grey", 0xFF808080)] + [InlineData("Gray", 0xFF808080)] + [InlineData("LightSlateGrey", 0xFF778899)] + [InlineData("LightSlateGray", 0xFF778899)] public void ParsesNamedColors(string name, uint argb) { var parsed = Utils.ParseColorString(name);