Method: Common::Color#colorize_text

Defined in:
lib/common/color.rb

#colorize_text(text, color, bold) ⇒ Object

Colorize the text.

Parameters:

  • text

    The text to color.

  • color

    The color.

  • bold

    Precise if we want to set the text in bold.

Author:

  • tmarmin



40
41
42
43
44
45
46
47
48
# File 'lib/common/color.rb', line 40

def colorize_text(text, color, bold)
  # set bold
  if bold == nil || bold == false || bold == 0
    bold=0
  else
    bold=1
  end
  return "\033[#{bold};#{color}m#{text}\033[0m"
end