Method: Rex::Ui::Text::Color#ansi

Defined in:
lib/rex/ui/text/color.rb

#ansi(*attrs) ⇒ Object

Return a string with ANSI codes substituted. Derived from code written by The FaerieMUD Consortium.



40
41
42
43
44
# File 'lib/rex/ui/text/color.rb', line 40

def ansi(*attrs)
  attr = attrs.collect {|a| AnsiAttributes[a] ? AnsiAttributes[a] : nil}.compact.join(';')
  attr = "\e[%sm" % attr if (attr.empty? == false)
  return attr
end