transform-colors
v1.0.1
Published
Color conversion and transform library
Downloads
1
Readme
transform-colors
Color conversion and transform library
Installation
npm install transform-colors
Usage
const transformColors = require('transform-colors');
console.log(transformColors.hex2hsl('#FF0000'));
Methods
rgb2hex(r, g, b)
const tsclr = require('transform-colors');
console.log(tsclr.rgb2hex(255,0,0));
// #FF0000
rgb2hsl(r, g, b)
const tsclr = require('transform-colors');
console.log(tsclr.rgb2hsl(255,0,0));
// [0, 50, 100]
hsl2hex(h, s, l)
const tsclr = require('transform-colors');
console.log(tsclr.hsl2hex(0, 50, 100));
// #FF0000
hsl2rgb(h, s, l)
const tsclr = require('transform-colors');
console.log(tsclr.hsl2rgb(0, 50, 100));
// [255, 0, 0]
hex2rgb(String #XXXXXX)
const tsclr = require('transform-colors');
console.log(tsclr.hex2rgb("#FF0000"));
// [255, 0, 0]
hex2hsl(String #XXXXXX)
const tsclr = require('transform-colors');
console.log(tsclr.hex2hsl("#FF0000"));
// [0, 50, 100]