Css Color Checker
A set of functions that check whether a string matches a particular color format.
; if console; // Valid CSS color values return a string; // Returns 'hex'; // Returns 'hex'; // Returns 'hex'; // Returns 'rgb'; // Returns 'rgba'; // Returns 'hsl'; // Returns 'hsla'; // Returns 'hwb'; // Returns 'red' // Everything else return null; // false; // false
Installation
npm install --save css-color-checker
or yarn add css-color-checker
How to use it
Note: If there is a leading or trailing space in the css color string (E.g. "#FFFFFF
"), all color matching functions will return false.