Method: Color::RGB#adjust_saturation
- Defined in:
- lib/atome/utilities/color_helper/color/rgb.rb
#adjust_saturation(percent) ⇒ Object
Returns a new colour with the saturation adjusted by the specified percentage. Negative percentages will reduce the saturation; positive percentages will increase the saturation.
Color::RGB::DarkBlue.adjust_saturation(10)
Color::RGB::DarkBlue.adjust_saturation(-10)
314 315 316 317 318 319 |
# File 'lib/atome/utilities/color_helper/color/rgb.rb', line 314 def adjust_saturation(percent) percent = normalize_percent(percent) hsl = to_hsl hsl.s *= percent hsl.to_rgb end |