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 committed Aug 9, 2024
1 parent 639239b commit 9f1df61
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 9f1df61

Please sign in to comment.