Color output functions

New in version 0.9.2.

Functions for wrapping strings in ANSI color codes.

Each function within this module returns the input string text, wrapped with ANSI color codes for the appropriate color.

For example, to print some text as green on supporting terminals:

from fabric.colors import green

print(green("This text is green!"))

Because these functions simply return modified strings, you can nest them:

from fabric.colors import red, green

print(red("This sentence is red, except for " +           green("these words, which are green") + "."))

If bold is set to True, the ANSI flag for bolding will be flipped on for that particular invocation, which usually shows up as a bold or brighter version of the original color on most terminals.

Changed in version 1.11: Added support for the shell env var FABRIC_DISABLE_COLORS; if this variable is present and set to any non-empty value, all colorization driven by this module will be skipped/disabled.

fabric.colors.blue(text, bold=False)
fabric.colors.cyan(text, bold=False)
fabric.colors.green(text, bold=False)
fabric.colors.magenta(text, bold=False)
fabric.colors.red(text, bold=False)
fabric.colors.white(text, bold=False)
fabric.colors.yellow(text, bold=False)