Module: ColorMath::Adjust
Overview
Adjust parameters of a colour
Instance Method Summary collapse
-
#blue(color, delta) ⇒ Object
Adjust the blue component by delta, stopping at 0 or 1.
-
#green(color, delta) ⇒ Object
Adjust the green component by delta, stopping at 0 or 1.
-
#hue(color, delta) ⇒ Object
Rotate the hue by delta degrees in either direction.
-
#luminance(color, delta) ⇒ Object
Adjust the luminance by delta, stopping at 0 or 1.
-
#red(color, delta) ⇒ Object
Adjust the red component by delta, stopping at 0 or 1.
-
#saturation(color, delta) ⇒ Object
Adjust the saturation by delta, stopping at 0 or 1.
Instance Method Details
#blue(color, delta) ⇒ Object
Adjust the blue component by delta, stopping at 0 or 1
33 34 35 |
# File 'lib/colormath/adjust.rb', line 33 def blue(color, delta) RGB.new(color.red, color.green, color.blue + delta) end |
#green(color, delta) ⇒ Object
Adjust the green component by delta, stopping at 0 or 1
28 29 30 |
# File 'lib/colormath/adjust.rb', line 28 def green(color, delta) RGB.new(color.red, color.green + delta, color.blue) end |
#hue(color, delta) ⇒ Object
Rotate the hue by delta degrees in either direction
8 9 10 |
# File 'lib/colormath/adjust.rb', line 8 def hue(color, delta) HSL.new(color.hue + delta, color.saturation, color.luminance) end |
#luminance(color, delta) ⇒ Object
Adjust the luminance by delta, stopping at 0 or 1
18 19 20 |
# File 'lib/colormath/adjust.rb', line 18 def luminance(color, delta) HSL.new(color.hue, color.saturation, color.luminance + delta) end |