Module: Cucumber::Formatters::ANSIColor

Includes:
Term::ANSIColor
Included in:
PrettyFormatter, ProgressFormatter
Defined in:
lib/gems/cucumber-0.1.15/lib/cucumber/formatters/ansicolor.rb

Overview

Defines aliases for coloured output. You can tweak the colours by defining a CUCUMBER_COLORS variable in your shell, very much like you can tweak the familiar POSIX command ls with <a href=“mipsisrisc.com/rambling/2008/06/27/lscolorsls_colors-now-with-linux-support/”>$LSCOLORS/$LS_COLORS</a>

The colours that you can change are:

  • missing - defaults to yellow

  • pending - defaults to yellow

  • pending_param - defaults to yellow,bold

  • failed - defaults to red

  • failed_param - defaults to red,bold

  • passed - defaults to green

  • passed_param - defaults to green,bold

  • outline - defaults to cyan

  • outline_param - defaults to cyan,bold

  • skipped - defaults to cyan

  • skipped_param - defaults to cyan,bold

  • comment - defaults to grey

  • tag - defaults to blue

For instance, if your shell has a black background and a green font (like the “Homebrew” settings for OS X’ Terminal.app), you may want to override passed steps to be white instead of green. Examples:

export CUCUMBER_COLORS="passed=white"
export CUCUMBER_COLORS="passed=white,bold:passed_param=white,bold,underline"

(If you’re on Windows, use SET instead of export). To see what colours and effects are available, just run this in your shell:

ruby -e "require 'rubygems'; require 'term/ansicolor'; puts Term::ANSIColor.attributes"

Although not listed, you can also use grey

Constant Summary collapse

ALIASES =
Hash.new do |h,k|
  if k.to_s =~ /(.*)_param/
    h[$1] + ',bold'
  end
end.merge({
  'missing' => 'yellow',
  'pending' => 'yellow',
  'failed'  => 'red',
  'passed'  => 'green',
  'outline' => 'cyan',
  'skipped' => 'cyan',
  'comment' => 'grey',
  'tag'     => 'blue'
})

Constants included from Term::ANSIColor

Term::ANSIColor::ATTRIBUTES, Term::ANSIColor::ATTRIBUTE_NAMES, Term::ANSIColor::COLORED_REGEXP

Instance Method Summary collapse

Methods included from Term::ANSIColor

attributes, coloring=, coloring?, #uncolored

Instance Method Details

#grey(m) ⇒ Object

Not supported in Term::ANSIColor



59
60
61
62
63
64
65
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/formatters/ansicolor.rb', line 59

def grey(m)
  if ::Term::ANSIColor.coloring?
    "\e[90m#{m}\e[0m"
  else
    m
  end
end