1.0.0 • Published 5 years ago

@sadbox/color v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Version License Dependencies Bundle Size Build Status Codecov

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