Skip to content

Commit

Permalink
🐛 fix(TextField): the hex color of TextColor doesn't work (#2091)
Browse files Browse the repository at this point in the history
  • Loading branch information
capdiem authored Aug 9, 2024
1 parent a3b255c commit 13afd28
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Masa.Blazor/Core/Styles/CssStyleUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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");
}
}

0 comments on commit 13afd28

Please sign in to comment.