Compare commits

..

2 commits

Author SHA1 Message Date
Benjamin Palko
8860138999 DOCS 2025-05-22 15:49:05 -04:00
Benjamin Palko
2d321a3d53 add color to server 2025-05-22 15:49:05 -04:00

View file

@ -1,3 +1,4 @@
using System.Text.RegularExpressions;
using SpacetimeDB;
public static partial class Module
@ -60,9 +61,10 @@ public static partial class Module
private static string ValidateColor(string color)
{
if (color[0] == '#' && color.Length != 4 || color.Length != 7)
var regex = new Regex("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$");
if (regex.IsMatch(color))
{
throw new Exception("Invalid Hex color code");
throw new Exception("Invalid color code");
}
return color;
}