Class: SpecTimer::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/spec_timer/reporter.rb

Constant Summary collapse

COLOR_CONVERSION =
{
  red:     1,
  green:   2,
  yellow:  3,
  blue:    4,
  magenta: 5,
  cyan:    6,
  white:   7
}

Class Method Summary collapse

Class Method Details

.background(string, color) ⇒ Object



39
40
41
# File 'lib/spec_timer/reporter.rb', line 39

def self.background(string, color)
  "\e[#{COLOR_CONVERSION[color] + 40}m#{string}\e[0m"
end

.text(string, color) ⇒ Object



35
36
37
# File 'lib/spec_timer/reporter.rb', line 35

def self.text(string, color)
  "\e[#{COLOR_CONVERSION[color] + 30}m#{string}\e[0m"
end