3 ms·
Yeah, basically build a linear (whatever that means in a polar color space) gradient between two colors. If you interpolate a bright red and bright cyan (compl
by tobr 7y ago
Yeah, basically build a linear (whatever that means in a polar color space) gradient between two colors.
If you interpolate a bright red and bright cyan (complementary colors), the midpoint would be gray in most color spaces. You can try it in your link. But in polar color spaces (like HSLUV and most of the ones starting with H) if you just lerp each of the numbers you have to pick a direction for the hue, and your cyan—red has to pass through a saturated green, yellow or blue, magenta. That rainbow effect can be nice but doesn’t feel linear. It also creates discontinuities when you change a color stop enough.
- mark-r 7y agoHere's a comparison between different methods of creating a gradient. https://stackoverflow.com/a/49321304/5987 https://stackoverflow.com/a/49321304/5987
- kuon 7y agoYes, now I see what you mean. Yeah HSLuv is not good for that. The SO answer @mark-r pointed gives a good information. Gradients are complicated beasts, and are often rendered wrong, even by popular softwares like browsers.
- dimovich 7y agoHere is a cosine based gradient generation [1]. And an example implementation from thi.ng/color [2]. [1] http://www.iquilezles.org/www/articles/palettes/palettes.htm http://www.iquilezles.org/www/articles/palettes/palettes.htm [2] https://github.com/thi-ng/color/blob/master/src/gradients.org#implementation https://github.com/thi-ng/color/blob/master/src/gradients.or...