quil

Eric 2022-06-21T03:16:08.989779Z

Does anyone know if itโ€™s possible to get HCL color in Quil?

genmeblog 2022-06-21T06:54:29.566839Z

If you're in the JVM land you can use clojure2d.color in quil. https://clojure2d.github.io/clojure2d/docs/codox/clojure2d.color.html#var-to-HCL

genmeblog 2022-06-21T06:57:49.135089Z

RGB color defined in quil will work in Clojure2d without any conversion.

genmeblog 2022-06-21T06:59:21.817829Z

To convert from Clojure2d to Quil call clojure2d.color/quil

genmeblog 2022-06-21T07:15:24.694239Z

HCL defined in Clojure2d is based on Sarifuddin/Missaou method with ฮป=3. If you want a converter based on CIELab color space use LCH. There are also other like: JCH (based on JzAzBz) and Oklch (based on Oklab).

Eric 2022-06-21T17:38:41.263089Z

That looks great, thank you! I suppose I can get most of the benefits of HCL by creating my gradients in HCL with Clojure2D, then converting back to the HSB space Iโ€™m using for most things in Quil.

genmeblog 2022-06-21T17:54:46.072809Z

Gradients are best in Oklab. You can find more about gradients here https://clojure2d.github.io/clojure2d/docs/notebooks/index.html#/notebooks/color.clj

genmeblog 2022-06-21T18:03:06.843839Z

And yeah, it's easy to make such interop. I can help you with this if you wish.

genmeblog 2022-06-21T18:04:55.256119Z

Generally hue based color spaces are not good for gradients, because they force traversing through many hue values.

๐Ÿ™ 1
Eric 2022-06-21T18:07:34.399909Z

Ahh, interesting. Yeah, I knew HSB worked better than RGB for that. Then I read about HCL preserving luminance across the hues, but Oklab is unknown to me so far.

genmeblog 2022-06-21T18:08:30.713169Z

Here is more about this: https://bottosson.github.io/posts/oklab/

genmeblog 2022-06-21T18:15:07.224029Z

Generally all linear luma based color spaces like lab, luv, oklab, jab, etc. are good when you want to keep brightness under control. All above also nicely blend hues.

genmeblog 2022-06-21T18:17:35.171149Z

Hue based just can introduce unwanted colors giving a rainbow effect. However, for generative art it can be very beneficial :)

Eric 2022-06-21T18:20:07.284689Z

I sometimes like the results of those hue rainbows, but there are definitely times when I want a gradient directly between two colors that are not adjacent in hue. I should certainly add a lab scheme to my toolbox. Thanks for the advice. :)

๐Ÿ‘ 1