https://github.com/caub/color-tf
RGB, HSL, HSV, HWB, ... color models transforms
https://github.com/caub/color-tf
Last synced: about 2 months ago
JSON representation
RGB, HSL, HSV, HWB, ... color models transforms
- Host: GitHub
- URL: https://github.com/caub/color-tf
- Owner: caub
- Created: 2017-09-01T09:57:34.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-21T15:47:37.000Z (about 8 years ago)
- Last Synced: 2025-09-01T02:49:26.122Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 89.8 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Color transforms between RGB, HSL, HSV and HWB, and more
[![npm version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![coverage status][codecov-image]][codecov-url]
sources:
* http://axonflux.com/handy-rgb-to-hsl-and-rgb-to-hsv-color-model-c
* http://alvyray.com/Papers/CG/hwb2rgb.htm
naming convention:
* foo2bar: input and output are in [0, 1]
* fooToBar: natural ranges: hues in [0, 360[, r/g/b in [0, 255], saturation/value/lightness in [0, 100]
The default export is a proxy, there are also [direct functions](https://unpkg.com/color-tf/) available
### Usage
```js
import colorTf from 'color-tf';
import hsl2hsv from 'color-tf/hsl2hsv';
colorTf.hslToRgb(200, 95, 62); // [ 66, 189, 250 ]
console.assert(hsl2hsv === colorTf.hsl2hsv);
```
[npm-image]: https://img.shields.io/npm/v/color-tf.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/color-tf
[travis-image]: https://img.shields.io/travis/caub/color-tf.svg?style=flat-square
[travis-url]: https://travis-ci.org/caub/color-tf
[codecov-image]: https://img.shields.io/codecov/c/github/caub/color-tf.svg?style=flat-square
[codecov-url]: https://codecov.io/gh/caub/color-tf