3 ms·
Yes - after I got over my anger (partly at myself for copying the function into my code without properly reading through it first) I sat down and worked out wha
by rikroots 5y ago
Yes - after I got over my anger (partly at myself for copying the function into my code without properly reading through it first) I sat down and worked out what was going on. The function, and the functions dependant on it, work fine if I replace NaN with 0.
As functions go, it is very neat and tidy. Some of the code I came across while searching for an RGB > HSL solution were ... not pleasant to read through.
- Someone 5y ago> Some of the code I came across while searching for an RGB > HSL solution > But the calculation for converting sRGB colors to HSL I don’t know whether you’re aware, but RGB and sRGB are different things. sRGB is device-independent, RGB is device-dependent. Depending on what the values in the RGB you have mean, that may or may not involve ‘not pleasant’ code. (Color is one of the items on the long list of things to try to avoid when programming. A few of the other items on that list are Unicode, dates and times, multi-threading and floating point. All have standards that aren’t pleasant, but also the most pleasant we have available)
- rikroots 5y ago> Color is one of the items on the long list of things to try to avoid when programming. Too late. I got annoyed by the lack of support for HWB, LCH and LAB in Chrome/Firefox. Safari now supports them for CSS, but has not yet made the effort to support them in the canvas element. I wanted users of my JS canvas library to be able to fill and stroke things using any valid CSS color string ... so I've been doing the work to make it happen over the holidays. It's been worth the effort. Red > Blue gradients look so, so much better when using LAB color space values, compared to what you normally get using RGB.