Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/petulla/d3-hsluv
D3 implementation of human-friendly HSL
https://github.com/petulla/d3-hsluv
color color-palette d3 hsluv rgb
Last synced: about 1 month ago
JSON representation
D3 implementation of human-friendly HSL
- Host: GitHub
- URL: https://github.com/petulla/d3-hsluv
- Owner: petulla
- License: bsd-3-clause
- Created: 2017-12-22T20:29:09.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-06T21:13:56.000Z (over 6 years ago)
- Last Synced: 2024-10-26T18:44:08.205Z (about 2 months ago)
- Topics: color, color-palette, d3, hsluv, rgb
- Language: JavaScript
- Homepage:
- Size: 50.8 KB
- Stars: 10
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-d3 - d3-hsluv - Human-friendly HSL (Hue, Saturation, Lightness) color space. (Utils)
- awesome-d3 - d3-hsluv - Human-friendly HSL (Hue, Saturation, Lightness) color space. (Utils)
- awesome-d3 - d3-hsluv - Human-friendly HSL (Hue, Saturation, Lightness) color space. (Utils)
README
# d3-hsluv
This module implements the [HSLuv](http://www.hsluv.org/) (Hue, Saturation, Lightness) color space.
## Installing
If you use NPM, `npm install d3-hsluv`. AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:
```html
var yellow = d3.hsluv("yellow"); // {l: 85.9, u: 100, v: 97.1, opacity: 1}
```
[Try d3-hsluv in your browser.](https://tonicdev.com/npm/d3-hsluv)
## API Reference
# d3.hsluv(l, u, v[, opacity])
# d3.hsluv(specifier)
# d3.hsluv(color)Constructs a new [hsluv](http://www.hsluv.org/) color. The channel values are exposed as `l`, `u` and `v` properties on the returned instance.
If *l*, *u* and *v* are specified, these represent the channel values of the returned color; an *opacity* may also be specified. If a CSS Color Module Level 3 *specifier* string is specified, it is parsed and then converted to the hsluv color space. See [d3.color](https://github.com/d3/d3-color#color) for examples. If a [*color*](https://github.com/d3/d3-color#color) instance is specified, it is converted to the RGB color space using [*color*.rgb](https://github.com/d3/d3-color#color_rgb) and then converted to hsluv.
# d3.interpolateHsluv(a, b) [<>](https://github.com/d3/d3-hsluv/blob/master/src/interpolateHsluv.js "Source")
Returns an HSLuv color space interpolator between the two colors a and b. The colors a and b need not be in HSLuv; they will be converted to HSLuv using d3.hsluv. If either color’s hue or chroma is NaN, the opposing color’s channel value is used. The shortest path between hues is used. The return value of the interpolator is an RGB string.
# d3.interpolateHsluvLong(a, b) [<>](https://github.com/d3/d3-hsluv/blob/master/src/interpolateHsluv.js "Source")
Like interpolateHsluv, but does not use the shortest path between hues.