Method: Colored#colorize

Defined in:
lib/upm/colored.rb

#colorize(string = nil, options = {}) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/upm/colored.rb', line 172

def colorize(string=nil, options = {})
  if string == nil
    return self.tagged_colors
  end

  if @@is_tty
    colored = [color(options[:foreground]), color("on_#{options[:background]}"), extra(options[:extra])].compact * ''
    colored << string
    colored << extra(:clear)
  else
    string
  end
end