Class: AwesomeExplain::Utils::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/awesome_explain/utils/color.rb

Constant Summary collapse

COLOR_ESCAPES =
{
  none: 0, bright: 1, black: 30,
  red: 31, green: 32, yellow: 33,
  blue: 34, magenta: 35, cyan: 36,
  white: 37, default: 39
}

Class Method Summary collapse

Class Method Details

.fg_color(clr, text) ⇒ Object



11
12
13
# File 'lib/awesome_explain/utils/color.rb', line 11

def self.fg_color(clr, text)
  "\x1B[" + (COLOR_ESCAPES[clr] || 0).to_s + 'm' + (text ? text + "\x1B[0m" : '')
end