[HN Gopher] HSLuv, a developer friendly perceptual color space ___________________________________________________________________ HSLuv, a developer friendly perceptual color space Author : kuon Score : 59 points Date : 2020-03-09 19:23 UTC (3 hours ago) (HTM) web link (www.kuon.ch) (TXT) w3m dump (www.kuon.ch) | dllu wrote: | I am a big fan of HSLuv and I use it for generating colourschemes | for lidar point clouds: | https://daniel.lawrence.lu/public/colortransform/#0_2584_964... | | which is used for videos such as this: | https://www.youtube.com/watch?v=eNt8D1mfwwo | somishere wrote: | Your link broke my back button :/ | dllu wrote: | Sorry about that. Fixed the link now. | nja wrote: | The amount of detail in that video is amazing. I noticed it can | partially see through chain link gates -- neat! | boulos wrote: | Interesting! I hadn't heard of HSLuv. The original writeup / blog | post [1] seems more informative though on "why" (hsluv.org is not | a very interesting landing page). | | I'm a little sad (disclosure: co-author) that we didn't make oRGB | [2] more popular. Perhaps we should put some source code online? | | [1] https://www.boronine.com/2012/03/26/Color-Spaces-for- | Human-B... | | [2] | https://www.cs.utah.edu/~bratkova/research/projects/orgb/org... | qwerty456127 wrote: | Green certainly looks darker than pink and blue at some point. | tobr wrote: | Maybe someone in this thread would have an answer to this | question: how do you interpolate between two colors in HSLUV? | Just interpolating each parameter doesn't give the right result, | since eg mixing two saturated complementary colors would create | an equally saturated color, rather than some shade of gray. | | Converting to CIELUV and mixing there doesn't seem safe since I | don't think it's a "convex" color space; you run the risk of | ending up with colors that can't be reproduced properly on a | screen. | kuon wrote: | By interpolating, you mean like given two colors, you want to | generate the intermediate gradient colors, like on this | article[1]? If that's the case, I don't see why interpolating | two saturated colors would provide a shade of gray. Can you | clarify? | | [1]: https://www.alanzucconi.com/2016/01/06/colour- | interpolation/ | tobr wrote: | 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. | leeoniya wrote: | > HSLuv is already available for many languages | | btw, the JS port is not perf-optimized (it's a straight | compilation from haxe to js). | | i hand-ported the C version [1] locally that avoids heap- | allocating any objects or arrays, which makes it about 40% | faster. i'm hoping it gets to replace the "official" js port at | some point, but i still need to run it through all the tests [2]. | if anyone is interested in helping out with this (i'm tight on | time right now), i'll publish it. | | initial benchmark of 100k random RGB triplets completes in 100ms | in Chrome 80 and 60ms in Firefox 73, on a pretty average Core | i5-7500T @ 2.70GHz. 1M triplets is 680ms in chrome and 421ms in | firefox. the official JS port gets 934ms in Chrome and 545ms in | Firefox for 1M triplets. | | For reference, a typical jpeg image contains < 300k unique | colors. | | [1] https://github.com/hsluv/hsluv-c | | [2] | https://github.com/hsluv/hsluv-c/blob/master/tests/scripts/s... | tobr wrote: | Not sure how much help I would be, but if it's any | encouragement I would very much appreciate a "real" JS version. | I looked at the JS version of HSLUV just the other week and was | bummed that it was compiled from Haxe. | kuon wrote: | This is great. I have to admit I usually "bake" my colors when | using JS so I have not been hit by the performances, but if it | can be done in a performent way, it can open new applications | in the browser. ___________________________________________________________________ (page generated 2020-03-09 23:00 UTC)