@csstools/convert-colors
Convert colors between RGB, HEX, HSL, HWB, LAB, LCH, and more
Last updated 9 months ago by romainmenke .
CC0-1.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @csstools/convert-colors 
SYNC missed versions from official npm registry.

Convert Colors Convert Colors

NPM Version

Convert Colors converts colors between RGB, HEX, HSL, HWB, LAB, LCH, and more.

import convert from '@csstools/convert-colors';

convert.rgb2hsl(100, 100, 100); // [ 0, 0, 100 ]
convert.rgb2hwb(100, 100, 100); // [ 0, 100, 0 ]

convert.hsl2rgb(0, 0, 100); // [ 0, 100, 0 ]
convert.hsl2hwb(0, 0, 100); // [ 0, 100, 0 ]

convert.hwb2rgb(0, 100, 0); // [ 0, 0, 100 ]
convert.hwb2hsl(0, 100, 0); // [ 0, 0, 100 ]

convert.rgb2hue(0, 0, 100); // 240

convert.rgb2contrast([100, 100, 100], [0, 0, 0]); // 21
convert.rgb2ciede2000([100, 100, 100], [0, 0, 0]); // 100

Usage

Add Convert Colors to your build tool:

npm install @csstools/convert-colors --save-dev

Features

Conversions work by taking arguments that represents a color in one color space and returning an array of that same color in another color space.

Documentation

Current Tags

  • 2.0.1                                ...           latest (9 months ago)

6 Versions

  • 2.0.1                                ...           9 months ago
  • 2.0.0                                ...           8 years ago
  • 1.4.0                                ...           9 years ago
  • 1.3.0                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Downloads
Total 14
Today 0
This Week 4
This Month 7
Last Day 0
Last Week 1
Last Month 5
Dependencies (0)
None
Dev Dependencies (5)

© 2010 - cnpmjs.org x YWFE | Home | YWFE