Value to check; anything that is not a non-empty string fails.
See ValidatorOptions.
{ valid, error }; error is null when valid.
GeoLeaf.Validators.validateColor("#ff0000"); // valide
GeoLeaf.Validators.validateColor("rgb(255, 0, 0)"); // valide
GeoLeaf.Validators.validateColor("rgba(0,0,0,0.5)"); // valide
GeoLeaf.Validators.validateColor("red"); // valide en navigateur (CSS.supports)
GeoLeaf.Validators.validateColor("hsl(120, 100%, 50%)"); // valide en navigateur
GeoLeaf.Validators.validateColor("#gggggg"); // invalide
Validates a CSS colour.
Three literal forms are recognised without help —
#RGB/#RRGGBB,rgb()andrgba(). Everything else (named colours,hsl(), modern syntaxes) is delegated toCSS.supports("color", …).⚠️ That fallback is browser-only. Where
CSSis undefined — Node, SSR, a bare test runner —"red"and"hsl(120, 100%, 50%)"are reported invalid, while the three literal forms keep working. A colour validated server-side is therefore not validated by the same rule as one validated in the page.