Method: HighLine#color
- Defined in:
- lib/highline.rb
#color(string, *colors) ⇒ String
This method provides easy access to ANSI color sequences, without the user needing to remember to CLEAR at the end of each sequence. Just pass the string to color, followed by a list of colors you would like it to be affected by. The colors can be HighLine class constants, or symbols (:blue for BLUE, for example). A CLEAR will automatically be embedded to the end of the returned String.
This method returns the original string unchanged if use_color? is false
.
328 329 330 331 |
# File 'lib/highline.rb', line 328 def color(string, *colors) return string unless use_color? HighLine.Style(*colors).color(string) end |