Skip to content

Commit

Permalink
Add Grey color overloads (#9788) Fixes #2170
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow authored Aug 31, 2022
1 parent a803700 commit ad3cf94
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/SingleProject/Resizetizer/src/ColorTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,19 @@ static class ColorTable
static Dictionary<string, SKColor> GetColors()
{
var colors = new Dictionary<string, SKColor>(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;
}

Expand Down
4 changes: 4 additions & 0 deletions src/SingleProject/Resizetizer/test/UnitTests/UtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ad3cf94

Please sign in to comment.