Compare commits
2 commits
8860138999
...
c8d4423ba8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8d4423ba8 | ||
|
|
d818b735e5 |
1 changed files with 2 additions and 4 deletions
|
|
@ -1,4 +1,3 @@
|
|||
using System.Text.RegularExpressions;
|
||||
using SpacetimeDB;
|
||||
|
||||
public static partial class Module
|
||||
|
|
@ -61,10 +60,9 @@ public static partial class Module
|
|||
|
||||
private static string ValidateColor(string color)
|
||||
{
|
||||
var regex = new Regex("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$");
|
||||
if (regex.IsMatch(color))
|
||||
if (color[0] == '#' && color.Length != 4 || color.Length != 7)
|
||||
{
|
||||
throw new Exception("Invalid color code");
|
||||
throw new Exception("Invalid Hex color code");
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue