From 9f1df61ab8a48a7b2c940e3d29879f34b2a97b64 Mon Sep 17 00:00:00 2001 From: capdiem Date: Fri, 9 Aug 2024 10:31:22 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(TextField):=20the=20hex=20co?= =?UTF-8?q?lor=20of=20TextColor=20doesn't=20work=20(#2091)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Masa.Blazor/Core/Styles/CssStyleUtils.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Masa.Blazor/Core/Styles/CssStyleUtils.cs b/src/Masa.Blazor/Core/Styles/CssStyleUtils.cs index 0f54c77cbe..cbce81dc4c 100644 --- a/src/Masa.Blazor/Core/Styles/CssStyleUtils.cs +++ b/src/Masa.Blazor/Core/Styles/CssStyleUtils.cs @@ -2,8 +2,6 @@ namespace Masa.Blazor.Core; public static class CssStyleUtils { - private static Regex _colorRegex = new(@"rgb\((\d+),\s*(\d+),\s*(\d+)\)", RegexOptions.Compiled); - public static string? GetTextColor(string? color, bool condition = true) { if (!condition || string.IsNullOrWhiteSpace(color) || !IsCssColor(color)) @@ -36,6 +34,6 @@ public static class CssStyleUtils private static bool IsCssColor(string color) { - return _colorRegex.Match(color).Success; + return color.StartsWith("#") || color.StartsWith("rgb") || color.StartsWith("hsl"); } } \ No newline at end of file