d3/d3-hsv

Name: d3-hsv

Owner: D3

Description: The HSV (Hue, Saturation, Value) color space.

Created: 2016-06-08 22:49:19.0

Updated: 2017-12-01 16:44:15.0

Pushed: 2017-04-06 15:18:11.0

Homepage:

Size: 17

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits
John Schulz2017-02-21 03:30:46.01
Mike Bostock2017-04-06 15:18:06.019

Other Committers

UserEmailMost Recent Commit# Commits

README

d3-hsv

This module implements the HSV (Hue, Saturation, Value) color space.

For example, to recreate R?s terrain.colors:

i0 = d3.interpolateHsvLong(d3.hsv(120, 1, 0.65), d3.hsv(60, 1, 0.90)),
i1 = d3.interpolateHsvLong(d3.hsv(60, 1, 0.90), d3.hsv(0, 0, 0.95));

tion interpolateTerrain(t) {
turn t < 0.5 ? i0(t * 2) : i1((t - 0.5) * 2);

Installing

If you use NPM, npm install d3-hsv. Otherwise, download the latest release. You can also load directly from d3js.org as a standalone library. AMD, CommonJS, and vanilla environments are supported. In vanilla, a d3 global is exported:

ipt src="https://d3js.org/d3-color.v1.min.js"></script>
ipt src="https://d3js.org/d3-hsv.v0.1.min.js"></script>
ipt>

yellow = d3.hsv("yellow"); // {h: 60, s: 1, v: 1, opacity: 1}

ript>

Try d3-hsv in your browser.

API Reference

# d3.hsv(h, s, v[, opacity])
# d3.hsv(specifier)
# d3.hsv(color)

Constructs a new HSV color. The channel values are exposed as h, s and v properties on the returned instance.

If h, s 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 HSV color space. See d3.color for examples. If a color instance is specified, it is converted to the RGB color space using color.rgb and then converted to HSV.

# d3.interpolateHsv(a, b)

?

# d3.interpolateHsvLong(a, b)

?


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.