d3 / d3-scale-chromatic

Sequential, diverging and categorical color scales.
https://d3js.org/d3-scale-chromatic
Other
801 stars 106 forks source link

Adding HSV colormap #34

Closed loichuder closed 3 years ago

loichuder commented 3 years ago

Hi there :wave:

We have a user requesting the HSV colormap in our project: https://github.com/silx-kit/h5web/issues/481.

As we use d3-scale-chromatic for our colormaps, we thought it might be better to add it here if it is a colormap you are interested in having ?

Fil commented 3 years ago

Doesn't it look a bit similar to sinebow https://github.com/d3/d3-scale-chromatic#cyclical

loichuder commented 3 years ago

Similar but not exactly the same apparently: https://mpetroff.net/2019/08/discernibility-of-rainbow-colormaps/

As Sinebow is the improved version of HSV, I would understand if you are not interested in having both.

mbostock commented 3 years ago

You can implement the angry rainbow by hand:

function interpolateAngryRainbow(t) {
  return d3.hsl(t * 360, 1, .5);
}

Use of this color scheme is strongly discouraged so I do not want to include it as a built-in scheme. (Note that this uses HSL and not HSV, but there’s a separate issue for supporting the HSV color space in d3-color.)