Class: Textbringer::Theme::Palette
- Inherits:
-
Object
- Object
- Textbringer::Theme::Palette
- Defined in:
- lib/textbringer/theme.rb
Instance Method Summary collapse
- #color(name, hex: nil, ansi: nil) ⇒ Object
-
#initialize ⇒ Palette
constructor
A new instance of Palette.
- #resolve(name, tier) ⇒ Object
Constructor Details
#initialize ⇒ Palette
Returns a new instance of Palette.
6 7 8 |
# File 'lib/textbringer/theme.rb', line 6 def initialize @colors = {} end |
Instance Method Details
#color(name, hex: nil, ansi: nil) ⇒ Object
10 11 12 |
# File 'lib/textbringer/theme.rb', line 10 def color(name, hex: nil, ansi: nil) @colors[name] = { hex: hex, ansi: ansi } end |
#resolve(name, tier) ⇒ Object
14 15 16 17 18 |
# File 'lib/textbringer/theme.rb', line 14 def resolve(name, tier) c = @colors[name] return nil unless c tier == :ansi ? c[:ansi] : c[:hex] end |