Returns true if the string is a valid CSS hex color (#rgb or #rrggbb).
true
#rgb
#rrggbb
The string to validate.
isHexColor("#fff") // => trueisHexColor("#1A2B3C") // => trueisHexColor("fff") // => false Copy
isHexColor("#fff") // => trueisHexColor("#1A2B3C") // => trueisHexColor("fff") // => false
Returns
trueif the string is a valid CSS hex color (#rgbor#rrggbb).