A simple utility function returning a boolean for whether or not a string is a valid web color
import validWebColor from 'valid-web-color';
console.log(validWebColor('#fff')); // true, short hex
console.log(validWebColor('#ffffff')); // true, long hex
console.log(validWebColor('white')); // true, named color
console.log(validWebColor('rgb(255,255,255)')); // true, RedGreenBlue
console.log(validWebColor('rgba(255,255,255, 1)')); // true, RedGreenBlueAlpha
console.log(validWebColor('hsl(0, 0%,100%)')); // true, HueSaturationLightness
console.log(validWebColor('hsla(0, 0%, 100%, 1)')); // true, HueSaturationLightnessAlpha
console.log(validWebColor('#sagdfhdfjd')); // false, random invalid string
console.log(validWebColor({})); // false, non-string