Class: Wasko::Palette::Base
- Inherits:
-
Object
- Object
- Wasko::Palette::Base
- Defined in:
- lib/wasko/palette.rb
Instance Method Summary collapse
- #ansi_colors? ⇒ Boolean
-
#black ⇒ Object
Returns a ‘color`-instance of black.
-
#initialize(color_string, contrast = 0) ⇒ Base
constructor
Takes a valid css color string and an optional contrast argument.
-
#white ⇒ Object
Returns a ‘color`-instance of white.
Constructor Details
#initialize(color_string, contrast = 0) ⇒ Base
Takes a valid css color string and an optional contrast argument. The contrast is useful to tweak the output of things.
It sets a base color ‘@base` and creates a color palette derived from the base color using the `colors!` method.
13 14 15 16 17 18 19 |
# File 'lib/wasko/palette.rb', line 13 def initialize(color_string, contrast = 0) @colors = {} @base = Wasko::Color.color_from_string(color_string) @base = white unless @base @contrast = 30 + contrast colors! end |
Instance Method Details
#ansi_colors? ⇒ Boolean
31 32 33 |
# File 'lib/wasko/palette.rb', line 31 def ansi_colors? p.colors[:yellow] end |
#black ⇒ Object
Returns a ‘color`-instance of black
27 28 29 |
# File 'lib/wasko/palette.rb', line 27 def black Wasko::Color.color_from_string("black") end |
#white ⇒ Object
Returns a ‘color`-instance of white
22 23 24 |
# File 'lib/wasko/palette.rb', line 22 def white Wasko::Color.color_from_string("white") end |