d3 / d3-color

Color spaces! RGB, HSL, Cubehelix, CIELAB, and more.
https://d3js.org/d3-color
ISC License
400 stars 91 forks source link

bug: hue is NaN when convert hsl #82

Closed zhuzhuaicoding closed 4 years ago

zhuzhuaicoding commented 4 years ago
var c = d3.hsl("#fafafa");
console.log(c) // {h: NaN,l: 0.9803921568627451,opacity: 1, s: 0}

h maybe 0

curran commented 4 years ago

But grays are devoid of hue. Why is this required?

mbostock commented 4 years ago

This is the expected and documented behavior for achromatic colors.

https://observablehq.com/@d3/achromatic-interpolation