Validate if a string is a valid color
- Published on
- Published on
- /1 mins read/---
WARNING
This util is for client-side only, do not use it in Server environments.
Simple color validator function
Usage
Caveat
Strings like unset
, initial
, inherit
, currentcolor
, transparent
are also valid values, so if you want to exclude these strings, just change the function a bit: