Class: TTYHue::TermColor::Theme

Inherits:
Base
  • Object
show all
Defined in:
lib/ttyhue/term_color.rb

Instance Method Summary collapse

Methods inherited from Base

#inspect

Constructor Details

#initialize(label, light) ⇒ Theme

Returns a new instance of Theme.



37
38
39
40
# File 'lib/ttyhue/term_color.rb', line 37

def initialize(label, light)
  @label = label
  @light = light
end

Instance Method Details

#color_nameObject



42
43
44
# File 'lib/ttyhue/term_color.rb', line 42

def color_name
  [('light' if @light), @label].compact.join("_").to_sym
end

#tag_nameObject



46
47
48
# File 'lib/ttyhue/term_color.rb', line 46

def tag_name
  [('l' if @light), @label].compact.join
end

#term_hex(bg) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/ttyhue/term_color.rb', line 50

def term_hex(bg)
  color_index = TermColor::LABELS.index(@label)
  if @light
    bg ? "10#{color_index}" : "9#{color_index}"
  else
    bg ? "4#{color_index}" : "3#{color_index}"
  end
end