Module: Sai::Decorator::Gradients Abstract Private
- Included in:
- Sai::Decorator
- Defined in:
- lib/sai/decorator/gradients.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 meant to be included in the Sai::Decorator class to provide color gradient methods
Color gradient methods for the Sai::Decorator class
Instance Method Summary collapse
-
#gradient(start_color, end_color, steps) ⇒ Decorator
Build a foreground gradient between two colors for text decoration.
-
#on_gradient(start_color, end_color, steps) ⇒ Decorator
Build a background gradient between two colors for text decoration.
-
#on_rainbow(steps) ⇒ Decorator
Build a background rainbow gradient for text decoration.
-
#rainbow(steps) ⇒ Decorator
Build a foreground rainbow gradient for text decoration.
Instance Method Details
#gradient(start_color, end_color, steps) ⇒ Decorator
Build a foreground gradient between two colors for text decoration
38 39 40 41 |
# File 'lib/sai/decorator/gradients.rb', line 38 def gradient(start_color, end_color, steps) colors = Conversion::RGB.transform.gradient(start_color, end_color, steps) dup.tap { |duped| duped.instance_variable_set(:@foreground_sequence, colors) } #: Decorator end |
#on_gradient(start_color, end_color, steps) ⇒ Decorator
Build a background gradient between two colors for text decoration
65 66 67 68 |
# File 'lib/sai/decorator/gradients.rb', line 65 def on_gradient(start_color, end_color, steps) colors = Conversion::RGB.transform.gradient(start_color, end_color, steps) dup.tap { |duped| duped.instance_variable_set(:@background_sequence, colors) } #: Decorator end |
#on_rainbow(steps) ⇒ Decorator
Build a background rainbow gradient for text decoration
86 87 88 89 |
# File 'lib/sai/decorator/gradients.rb', line 86 def on_rainbow(steps) colors = Conversion::RGB.transform.rainbow_gradient(steps) dup.tap { |duped| duped.instance_variable_set(:@background_sequence, colors) } #: Decorator end |
#rainbow(steps) ⇒ Decorator
Build a foreground rainbow gradient for text decoration
107 108 109 110 |
# File 'lib/sai/decorator/gradients.rb', line 107 def rainbow(steps) colors = Conversion::RGB.transform.rainbow_gradient(steps) dup.tap { |duped| duped.instance_variable_set(:@foreground_sequence, colors) } #: Decorator end |