Module: Cucumber::Formatter::ANSIColor
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:
-
undefined
- defaults toyellow
-
pending
- defaults toyellow
-
pending_param
- defaults toyellow,bold
-
failed
- defaults tored
-
failed_param
- defaults tored,bold
-
passed
- defaults togreen
-
passed_param
- defaults togreen,bold
-
outline
- defaults tocyan
-
outline_param
- defaults tocyan,bold
-
skipped
- defaults tocyan
-
skipped_param
- defaults tocyan,bold
-
comment
- defaults togrey
-
tag
- defaults tocyan
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({ 'undefined' => 'yellow', 'pending' => 'yellow', 'failed' => 'red', 'passed' => 'green', 'outline' => 'cyan', 'skipped' => 'cyan', 'comment' => 'grey', 'tag' => 'cyan' })
Instance Method Summary collapse
-
#grey(m) ⇒ Object
Not supported in Term::ANSIColor.
Instance Method Details
#grey(m) ⇒ Object
Not supported in Term::ANSIColor
64 65 66 67 68 69 70 |
# File 'lib/cucumber/formatter/ansicolor.rb', line 64 def grey(m) if ::Term::ANSIColor.coloring? "\e[90m#{m}\e[0m" else m end end |