From a397c686b8f079778e78c57f76a6be37f8eb21ea Mon Sep 17 00:00:00 2001 From: Atanas Korchev Date: Mon, 4 Nov 2024 09:21:01 +0200 Subject: [PATCH] Avoid using `new Dictionary(StringComparer.InvariantCultureIgnoreCase)`. Should fix #1705. --- Radzen.Blazor/Rendering/RGB.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Radzen.Blazor/Rendering/RGB.cs b/Radzen.Blazor/Rendering/RGB.cs index 09ae653b72b..7ac1fe51e84 100644 --- a/Radzen.Blazor/Rendering/RGB.cs +++ b/Radzen.Blazor/Rendering/RGB.cs @@ -6,14 +6,11 @@ namespace Radzen.Blazor.Rendering { /// - /// Class RGB. + /// Utility class used to parse and convert RGB colors. /// public class RGB { - /// - /// The known colors - /// - private static Dictionary knownColors = new Dictionary(StringComparer.InvariantCultureIgnoreCase) + private static readonly Dictionary knownColors = new() { ["black"] = "000000", ["silver"] = "c0c0c0", @@ -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); }