Class: Vedeu::ColourTranslator

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/models/attributes/colour_translator.rb

Instance Method Summary collapse

Constructor Details

#initialize(html_colour = '') ⇒ ColourTranslator



3
4
5
# File 'lib/vedeu/models/attributes/colour_translator.rb', line 3

def initialize(html_colour = '')
  @html_colour = html_colour
end

Instance Method Details

#backgroundObject



7
8
9
10
11
# File 'lib/vedeu/models/attributes/colour_translator.rb', line 7

def background
  return '' unless valid?

  ["\e[48;5;", translate, 'm'].join
end

#foregroundObject



13
14
15
16
17
# File 'lib/vedeu/models/attributes/colour_translator.rb', line 13

def foreground
  return '' unless valid?

  ["\e[38;5;", translate, 'm'].join
end