Class: Textbringer::Theme::Palette

Inherits:
Object
  • Object
show all
Defined in:
lib/textbringer/theme.rb

Instance Method Summary collapse

Constructor Details

#initializePalette

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