Module: Sai::Decorator::ColorManipulations Abstract Private
- Included in:
- Sai::Decorator
- Defined in:
- lib/sai/decorator/color_manipulations.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
This module is abstract.
This module is meant to be included in the Sai::Decorator class to provide color manipulation methods
Color manipulation methods for the Sai::Decorator class
Instance Method Summary collapse
-
#darken_background(amount) ⇒ Decorator
(also: #darken_bg)
Darken the background color by a percentage.
-
#darken_text(amount) ⇒ Decorator
(also: #darken_fg, #darken_foreground)
Darken the text color by a percentage.
-
#lighten_background(amount) ⇒ Decorator
(also: #lighten_bg)
Lighten the background color by a percentage.
-
#lighten_text(amount) ⇒ Decorator
(also: #lighten_fg, #lighten_foreground)
Lighten the text color by a percentage.
Instance Method Details
#darken_background(amount) ⇒ Decorator Also known as: darken_bg
Darken the background color by a percentage
28 29 30 31 32 |
# File 'lib/sai/decorator/color_manipulations.rb', line 28 def darken_background(amount) raise ArgumentError, "Invalid percentage: #{amount}" unless amount >= 0.0 && amount <= 1.0 darken(amount, :background) end |
#darken_text(amount) ⇒ Decorator Also known as: darken_fg, darken_foreground
Darken the text color by a percentage
50 51 52 53 54 |
# File 'lib/sai/decorator/color_manipulations.rb', line 50 def darken_text(amount) raise ArgumentError, "Invalid percentage: #{amount}" unless amount >= 0.0 && amount <= 1.0 darken(amount, :foreground) end |
#lighten_background(amount) ⇒ Decorator Also known as: lighten_bg
Lighten the background color by a percentage
74 75 76 77 78 |
# File 'lib/sai/decorator/color_manipulations.rb', line 74 def lighten_background(amount) raise ArgumentError, "Invalid percentage: #{amount}" unless amount >= 0.0 && amount <= 1.0 lighten(amount, :background) end |
#lighten_text(amount) ⇒ Decorator Also known as: lighten_fg, lighten_foreground
Lighten the text color by a percentage
96 97 98 99 100 |
# File 'lib/sai/decorator/color_manipulations.rb', line 96 def lighten_text(amount) raise ArgumentError, "Invalid percentage: #{amount}" unless amount >= 0.0 && amount <= 1.0 lighten(amount, :foreground) end |