Module: HEITT::Color

Defined in:
lib/heitt/utils.rb

Class Method Summary collapse

Class Method Details

.colorize(text, color, *styles) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/heitt/utils.rb', line 46

def self.colorize(text, color, *styles)
  return text unless STDOUT.isatty #&& !(defined?(Flags) && Flags.no_color)

  colored = text.colorize(color)
  styles.each do |style|
    colored = colored.send(style)
  end
  colored
end