Class: Graphics::Hue
Overview
The full RGB spectrum
Instance Attribute Summary
Attributes inherited from Rainbow
Instance Method Summary collapse
-
#_color(degree) ⇒ Object
:nodoc:.
Methods inherited from Rainbow
#cache_colors, #clamp, #color, #initialize, #scale
Constructor Details
This class inherits a constructor from Graphics::Rainbow
Instance Method Details
#_color(degree) ⇒ Object
:nodoc:
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/graphics/rainbows.rb', line 64 def _color degree # :nodoc: main_color = 1 * 255 # Let chroma (saturation * brightness) always == 1 second_strongest_color = ((1 - (degree/60.0 % 2 - 1).abs) * 255).floor case degree when 0..60 [main_color, second_strongest_color, 0] when 61..120 [second_strongest_color, main_color, 0] when 121..180 [0, main_color, second_strongest_color] when 181..240 [0, second_strongest_color, main_color] when 241..300 [second_strongest_color, 0, main_color] when 301..360 [main_color, 0, second_strongest_color] end end |