omgovich / colord

👑 A tiny yet powerful tool for high-performance color manipulations and conversions
https://colord.omgovich.ru
MIT License
1.67k stars 49 forks source link

Retain Hue & Saturation at Light Max & Min #75

Closed 2manypistachios closed 2 years ago

2manypistachios commented 2 years ago

I ran into an issue where my users could control a color wheel, and control the lightness level separately from hue and saturation. If they were to go absolute white or absolute dark, then they would lose their hue and saturation values. It creates a fairly jarring effect on the app.

Animation

Would appreciate some advice.

omgovich commented 2 years ago

Hi, I would say it's a common problem that every color picker developer faces. Just check a saturation of new color and if it's 0 or 100 — don't change an internal hue value. I guess you might find a solution, for example, in react-color package code.