Introduction
Module parses color and determines its shade by hue value.
By default it uses data from WorkWithColor.com, but you can set custom rules for shades.
Installation
npm install check-color
Usage
var color = ; // lime == #00ff00color; // 'green'color; // truecolor; // false // coral == #ff7f50 (base shades are true for intermediate colors)color; // 'red-orange'color; // truecolor; // truecolor; // truecolor; // false
You can pass as argument everything that parse-color can parse (e.g red
, #ffff00
, rgb(255, 0, 0)
)
Methods of module depend on config. Default config is in src/defaults.js, default methods are:
isRed, isRedOrange, isOrange, isOrangeYellow, isYellow, isYellowGreen, isGreen, isGreenCyan, isCyan, isCyanBlue, isBlue, isBlueMagenta, isMagenta, isMagentaPink, isPink, isPinkRed
Also there is getShade method, that returns shade name for color based on config.
You can set custom config with init method.
var color = ;color; // Here you can use methods 'isA', 'isB', 'isC'console;