0.1.1 • Published 9 years ago

color-conv v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

color-conv

Build Status

Install

npm install color-conv

Usage

var cc = require('color-conv');

cc.schemas; // ['rgba', 'rgb', 'hex', 'hsla', 'hsl']
cc.support('hex'); // true
cc.support('abc'); // false

var color = cc.rgba(12, 34, 56, 0.5);
color.str(); // rgba(12, 34, 56, 0.5)
color.arr(); // [12, 34, 56, 0.5]
color.rgb();
color.hex();
color.hsla();
color.hsl();

color = cc.rgb(12, 34, 56);
color.str();
color.arr();
color.rgba();
color.hex();
color.hsla();
color.hsl();

color = cc.hex('#aabbcc');
color.str(true); // #abc
color.str(); // #aabbcc
color.rgba();
color.hex();
color.hsla();
color.hsl();

color = cc.hsla(230, 65, 13, 0.6);
color.str();
color.arr();
color.rgba();
color.rgb();
color.hex();
color.hsl();

color = cc.hsl(230, 65, 13);
color.str();
color.arr();
color.rgba();
color.rgb();
color.hex();
color.hsla();