You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
520 B
C#
19 lines
520 B
C#
using System.Text.RegularExpressions;
|
|
|
|
namespace OMS.NET.Common
|
|
{
|
|
public static class Validations
|
|
{
|
|
/// <summary>
|
|
/// 验证颜色值是否有效
|
|
/// </summary>
|
|
/// <param name="color"></param>
|
|
/// <returns></returns>
|
|
public static bool IsHexColor(string color)
|
|
{
|
|
// Regex for hex color code (with or without #)
|
|
var hexColorRegex = new Regex(@"^#?[0-9A-Fa-f]{6}$");
|
|
return hexColorRegex.IsMatch(color);
|
|
}
|
|
}
|
|
} |