jaames / iro.js

🎨 Modular color picker widget for JavaScript, with support for a bunch of color formats
https://iro.js.org
Mozilla Public License 2.0
1.3k stars 81 forks source link

[feature] Smoother hue color ramps #114

Closed jaames closed 4 years ago

jaames commented 4 years ago

Note to future James: it might be interesting to incorporate something like Jim Bumgardner's "sinebows" to have smoother hue ramps:

https://observablehq.com/@mbostock/sinebow

http://basecase.org/env/on-rainbows

https://www.shadertoy.com/view/4tlBWB

https://observablehq.com/@mattdesl/perceptually-smooth-multi-color-linear-gradients

rjsachse commented 4 years ago

FastLed for the arduino family has this too... Might be good to look at to

drzony commented 4 years ago

Just a word of warning, messing with rainbows might pose a problem. Although they will look better, they will be incompatible with other HSV. As @rjsachse mentioned FastLED has it, but it means that green on FastLED is (H=96, S=100, V=100) and on iro it's (H=85, S=100, V=100). Here are the details

jaames commented 4 years ago

@drzony In this case it wouldn't affect how the color is actually chosen -- iro.js never picks from what's drawn on the screen anyway, it just figures out what the color should be based on the position of the handles. Because of that, I think I can justify messing with it a tiny bit to make it look nicer :)

I'm basically looking into adding an (optional) way to smooth out the sharper parts of the hue ramp around where the color approaches cyan, magenta and yellow:

Screenshot 2020-08-11 at 22 34 52
drzony commented 4 years ago

Yes, but if you smooth it out, take the position of the handles, then put the value of the color into some other software, then the color under the handle will look different than the color in this other software. It may even look different than the color on the lower slider. Maybe it won't be noticeable, maybe it will be very confusing to the user. I just wanted to point your attention towards it. I'm doing a project on FastLED and matching what's on screen with LED color calibration is already a nightmare, without adding any more surprises to it :-)