Module: TeutonGet::Format

Defined in:
lib/teuton-get/utils/format.rb

Constant Summary collapse

COLORS =
[:light_blue, :light_magenta, :light_cyan, :red, :green, :yellow]

Class Method Summary collapse

Class Method Details

.colorize(text = "", option = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/teuton-get/utils/format.rb', line 7

def self.colorize(text = "", option = nil)
  return text if option.nil?
  color = if option.instance_of? Integer
    if option < COLORS.size
      COLORS[option]
    else
      COLORS[option - COLOR.size]
    end
  elsif option.instance_of? Symbol
    option
  else
    :silver
  end
  text.colorize(color)
end