svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
11.15k stars 1.08k forks source link

Answer on TODO in color.js #1037

Closed renevanderlende closed 4 years ago

renevanderlende commented 5 years ago

In 'color.js', row 180 you say 'TODO I have no idea what this does :D If you figure it out, tell me!'

Well, I don't have a definitive answer for you, but near the end of document wikipedia: Comparison of color models in computer graphics paragraph 'HSL' you will find an explanantion of, what I think, the 0.5 value you (and B. Grinstead) use in your JS at line 181. Read wikipedia: HSL and HSV paragraphs 'Hue and chroma', 'Lightness' and 'Saturation' for the used HSL/V math.

I hope this will shed some light on the matter.

Finally, I found Color FAQ very enlightning on the subject of color in general.

Cheers, Rene

P.S.: CSS Color Module Level 4, Editor’s Draft, 9 August 2019 paragraph 16 Sample code for color conversions has a nice bundle of extra color conversion JS ready to use. Make sure to check it out.

saivan commented 5 years ago

Wow, I really appreciate you taking the time to actually respond to me :P I didn't spend too much time looking into it at the time, but it looks like we have some weekend reading.

Thanks for that :) Feel free to make a pr with an explanatory comment if you want.

saivan commented 4 years ago

Awesome, so I've read up. I'll go ahead and close the issue but leave it as reference for anybody who might come across it in the future. Thanks again @renevanderlende