Method: ColorMath::RGB#hue
- Defined in:
- lib/colormath/color/rgb.rb
#hue ⇒ Object
The hue component of the colour in HSL representation where 0 <= h < 360
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/colormath/color/rgb.rb', line 25 def hue return 0 if saturation.zero? case max when red (60.0 * ((green - blue) / (max - min))) % 360.0 when green 60.0 * ((blue - red) / (max - min)) + 120.0 when blue 60.0 * ((red - green) / (max - min)) + 240.0 end end |