jfairbank / chroma

Ruby gem for color manipulation and palette generation
ISC License
234 stars 29 forks source link

Change color opacity with chroma? #25

Closed matildasmeds closed 7 years ago

matildasmeds commented 7 years ago

On one hand it's easy to add alpha values to Strings manually. On the other hand, Chroma supports alpha values already, so adding a way to change opacity feels natural in some sense. Having done it manually, I don't think it looks pretty, and it would be nice if the gem could do it.

If there is support for the idea, it might be helpful to sketch the interface a bit, to start in the right direction. :art:

If opacity/transparency concepts yielded easy, naturally paired verbs, such as "darken"/"lighten", it might make sense to model after that. As I can't find such a pair, I would suggest .opacity(20) which would the opacity to a percentage. Hence it would be a bit similar to .grayscale, but with a parameter.

How does this sound? Any considerations? I can do it, but would be nice to get go ahead before contributing. 🙏

jfairbank commented 7 years ago

Hi, @matildasmeds!

Sorry for the late response. I think this is a great idea. I can't think of a good "pair" as you mention for opacity, and I'm not sure that would make sense for this feature. So, I'm on board with just a .opacity method. Would it make more sense for it take a value from 0-1 since that's the more familiar form in rgba?