$ component install timoxley/colornames
$ npm install colornames
var toHex = require('colornames')
toHex('red') // => "#FF0000"
toHex('blue') // => "#0000FF"
toHex('lightsalmon') // => "#FFA07A"
toHex('mediumvioletred') // => "#C71585"
toHex.get('red')
// =>
{
name: "red",
css: true,
value: "#FF0000",
vga: true
}
toHex('Blue') // => "#0000FF"
toHex('BLUE') // => "#0000FF"
toHex('BlUe') // => "#0000FF"
Get HEX code for a color name, or undefined
if unknown.
All known data about color, including whether valid VGA or CSS color name.
HEX code for a color name, only if the color is a valid VGA color name.
HEX code for a color name, only if the color is a valid CSS color name.
###.all() Get all color names data.
MIT