halostatue / color

Color tools for Ruby.
Other
133 stars 41 forks source link

Fixed alpha channel may make the gem useless for some purposes #14

Open grv87 opened 9 years ago

grv87 commented 9 years ago

At this moment all the colors have fixed alpha channel. This makes the gem useless for some purposes (i.e. CSS). What is a reason to have css_rgba if it anyway substitutes 1 for alpha?

I started to add alpha channels to RGB and other classes, but there is one problem, so I want to ask first. Is it OK if initialize functions will change its parameters? For example, for RGB:

  def initialize(r = 0, g = 0, b = 0, a = nil, radix = 255.0, &block) # :yields self:

Code depending on radix parameter will have to be updated then. Considering that color-2 is in development, I think that it's OK.

Another approach is to create separate classes RGBA and so on. Since alpha channel can be applied to each color model, it is questionable way.

What do you think or plan?

halostatue commented 8 years ago

For different reasons, I am going to be releasing one more Color 1.x release and then I hope to get back to color-2 in the new year. When I move that direction, I am probably moving toward making it support Ruby 2 only especially for new parameters so as to support keyword arguments.

halostatue commented 8 years ago

This has been partially resolved by allowing css_rgba to accept an optional alpha parameter (defaulting to 1) in the just-release 1.8.