color_name_converter
v0.0.2
Published
"converts html color names to a format of your choice"
Downloads
4
Maintainers
Readme
color_name_to_rgb
converts an html color name to a format of your choice
#Installation
npm install color_name_converter
#Usage
First you require the library:
var color = require("color_name_to_rgb");
Invoking is easy. You just write:
var output = color("gold");
The output will be:
var output = 'rgb(255,215,0)';
As a default the function returns a rgb string. But you can define your format too:
var output = color("gold", "hex");
// output = ''#ffd700'';
var output = color("gold", "rgba");
// output 'rgb(255,215,0,1 )'
var output = color("gold", "array");
// output [255, 215, 0, 1]
Valid formats are rgb, rgba, hex, array, object