@sadbox/color
v1.0.0
Published
Color parser
Downloads
7
Readme
Color
A lightweight browser compatible color parser.
Installation
npm install @sadbox/color
yarn add @sadbox/color
Supported formats
#xxx
#xxxx
#xxxxxx
#xxxxxxxx
rgb()
rgba()
hsl()
hsla()
How to use
import { Color } from '@sadbox/color';
const color = new Color('#ffff');
color.rgb; // [255, 255, 255]
color.hsl; // [0, 0, 100]
color.alpha; // 1
color.rgb = [0, 0, 0];
color.hsl; // [0, 0, 0]
console.log(color); // #000000