Class: MinitestBender::Colorizer

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest-bender/colorizer.rb

Constant Summary collapse

COLORS =

Xterm No. - Xterm Name

{              # Xterm No. - Xterm Name
  pass:       '87ff87', # 120       - LightGreen
  skip:       '5fd7ff', # 81        - SteelBlue1
  fail:       'ff5f5f', # 203       - IndianRed1
  error:      'ffd75f', # 221       - LightGoldenrod2
  tests:      '5fafaf', # 73        - CadetBlue
  assertions: 'd75fd7', # 170       - Orchid
  time:       '878787', # 102       - Grey53
  number:     '5fafaf', # 73        - CadetBlue
  backtrace:  'af8787'  # 138       - RosyBrown
}
SAFE_COLORS =

In compatibility modes, colors that are mapped to black are avoided.

{
  pass:       '00ff5f', # 47        - SpringGreen2
  tests:      'blue',
  time:       'gray',
  number:     'gray',
  backtrace:  'gray'
}

Class Method Summary collapse

Class Method Details

.color_keysObject



46
47
48
# File 'lib/minitest-bender/colorizer.rb', line 46

def color_keys
  COLORS.keys
end

.colorize(string, color, *args) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/minitest-bender/colorizer.rb', line 37

def colorize(string, color, *args)
  if color == :normal
    Paint[string, *args]
  else
    color_value = colors.fetch(color)
    Paint[string, color_value, *args]
  end
end

.custom_colors=(custom_colors) ⇒ Object



33
34
35
# File 'lib/minitest-bender/colorizer.rb', line 33

def custom_colors=(custom_colors)
  @custom_colors = custom_colors
end