Skip to content

Commit

Permalink
Avoid using `new Dictionary<string, string>(StringComparer.InvariantC…
Browse files Browse the repository at this point in the history
…ultureIgnoreCase)`. Should fix #1705.
  • Loading branch information
akorchev committed Nov 4, 2024
1 parent 9b92005 commit a397c68
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Radzen.Blazor/Rendering/RGB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
namespace Radzen.Blazor.Rendering
{
/// <summary>
/// Class RGB.
/// Utility class used to parse and convert RGB colors.
/// </summary>
public class RGB
{
/// <summary>
/// The known colors
/// </summary>
private static Dictionary<string, string> knownColors = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase)
private static readonly Dictionary<string, string> knownColors = new()
{
["black"] = "000000",
["silver"] = "c0c0c0",
Expand Down Expand Up @@ -238,7 +235,7 @@ public static RGB Parse(string color)
return new RGB { Red = red, Green = green, Blue = blue };
}

if (knownColors.TryGetValue(color, out var knownColor))
if (knownColors.TryGetValue(color.ToLowerInvariant(), out var knownColor))
{
return Parse(knownColor);
}
Expand Down

0 comments on commit a397c68

Please sign in to comment.