This module implements the HSV (Hue, Saturation, Value) color space.
For example, to recreate R’s terrain.colors:
var 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));
function interpolateTerrain(t) {
return t < 0.5 ? i0(t * 2) : i1((t - 0.5) * 2);
}
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:
<script src="https://d3js.org/d3-color.v1.min.js"></script>
<script src="https://d3js.org/d3-hsv.v0.1.min.js"></script>
<script>
var yellow = d3.hsv("yellow"); // {h: 60, s: 1, v: 1, opacity: 1}
</script>
# 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.
Returns an HSV color space interpolator between the two colors a and b. The colors a and b need not be in HSV; they will be converted to HSV using d3.hsv. 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.interpolateHsvLong(a, b) <>
Like interpolateHsv, but does not use the shortest path between hues.
d3-hsv's People
Forkers
gerhobbelt denisname stof isabella232 3dhead pony-boy qpc-github quantum-platinum-cloud ghas-results seanpm2001d3-hsv's Issues
Update to d3-color 3.1.0
Hi @Fil ,
Since there are two high vulnerabilities found in the current version used of [d3-color](https://github.com/d3/d3-color)
, could you update this package as well? Thank you in advance!
Merge into d3-color, d3-interpolate.
Include standard HSV range in documentation
I think it would be really helpful to include the standard domain for h, s, and v. This is something the main d3-color package already does for hcl etc, seems like it'd be good to do here as well.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.