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

Add hue manipulation #48

Closed GMartigny closed 3 years ago

GMartigny commented 3 years ago

The library support saturation and lightness manipulation but not hue. This was quite surprising for me.

I can propose a PR if you're ok with it.

omgovich commented 3 years ago

Hey 👋 Could you please provide some examples of the API you need? As far as I understand you suggested to add something like colord('#abc').spin(-90), right?

GMartigny commented 3 years ago

"Need" is a strong word, but yeah colord("#123").spin(), colord("#123").rotate() or colord("#123").hue() could be a logical addition to the API (IMO).

omgovich commented 3 years ago

Thanks for your advice, I'll definitely think about that ❤️ I try to keep the core as light as possible and avoid extra methods, but having one or two hue manipulation methods seems logical, totally agree!

paarthenon commented 3 years ago

I'd like to second this request. I started using this library today and was surprised when hue manipulation didn't exist. It felt a bit more unexpected because saturation and light value adjustment both do.

I ended up translating to hsl and manipulating the values in that model. This was no big deal, but a built in feature would have been nice to avoid the hiccup.

I'm also open to contributing it if you have the desire but not the time.


p.s. Think of how nice it would be for color palette generation :)

omgovich commented 3 years ago

Hey guys! I just came back from my honeymoon. Going to add the hue manipulation methods later this week. If you like to contribute, it's okay to make a PR.

omgovich commented 3 years ago

Hey guys! Check v2.1 with the new hue and rotate methods included.

paarthenon commented 3 years ago

Seems to work well, thank you for being open to the change!