Class: String

Inherits:
Object show all
Defined in:
lib/rcl/ext/ansicolour.rb

Instance Method Summary collapse

Instance Method Details

#colour(newcolour, *colours) ⇒ Object Also known as: color



104
105
106
107
# File 'lib/rcl/ext/ansicolour.rb', line 104

def colour(newcolour, *colours)
  attr = Term::ANSIColour.attributes
  [newcolour, colours].flatten.map {|c| "\e\[#{attr[c]}m"}.join + self.to_s + "\e\[#{attr['reset']}m"
end