Color gem

I’m using the ruby gem “Color” and I’m having some troubles with to_hex.

I’ve installed the gem, and when I try and run the test program I get
this error:

red = Color.new(‘ff0000’)
=> #<Color:0x3685990 @saturation=1.0, @hue=0.0, @lightness=0.5>

yellow = Color.new(‘ffff00’)
=> #<Color:0x367e5a0 @saturation=1.0, @hue=0.166666666666667,
@lightness=0.5>

orange = red.mix_with yellow, 0.5
=> #<Color:0x3675c34 @saturation=0.503875968992248,
@hue=0.0820512820512821, @lightness=0.252941176470588>

orange.to_hex
NoMethodError: You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.collect
from
/Applications/Locomotive2/Bundles/rmagickRailsMar2007_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/color-0.1.0/lib/color.rb:91:in
rgb_to_rgbhex' from /Applications/Locomotive2/Bundles/rmagickRailsMar2007_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/color-0.1.0/lib/color.rb:81:into_hex’
from (irb):15

Does anyone know what’s going on here? Thanks in advance.

On 8/25/07, Mariko C. [email protected] wrote:

I’m using the ruby gem “Color” and I’m having some troubles with to_hex.

I’ve installed the gem, and when I try and run the test program I get
this error:

I recommend holding off on the use of this particular gem; use
color-tools instead, or use Stefan’s color gem on the butler project.

There are three colour manipulation projects that are being pulled
together in one way or another; the Color project and color-tools have
already been merged, but there’s been a lack of maintainer time to
release an updated version.

-austin

Austin Z. * [email protected] * http://www.halostatue.ca/
* [email protected] * http://www.halostatue.ca/feed/
* [email protected]

I’ll look into those. Thanks for the response.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs