Colorized output

gluetool uses awesome colorama library to enhance many of its outputs with colors. This is done in a transparent way, when developer does not need to think about it, and user can control this feature with a single option.

Control

Color support is disabled by default, and can be turned on using --color option:

If colorama package is not installed, color support cannot be turned on. If user tries to do that, gluetool will emit a warning:

Note

As of now, colorama is gluetool‘s hard requirement, therefore it should not be possible - at least out of the box - to run gluetool wihout having colorama installed. However, this may change in the future, leaving this support up to user decision.

To control this feature programatically, see gluetool.color.switch().

Todo

  • seealso:
    • how to specify options

Colorized logs

Messages, logged on the terminal, are colorized based on their level:

DEBUG log level inherits default text color of your terminal, while, for example, ERROR is highlighted by being red, and INFO level is printed with nice, comforting green.

Todo

  • seealso:
    • logging

Colorized help

gluetool uses reStructuredText (reST) to document modules, shared functions, opitons and other things, and to make the help texts even more readable, formatting, provided by reST, is enhanced with colors, to help users orient and focus on important information.

Todo

  • seealso:
    • generic help
    • module help
    • option help

Colors in templates

Color support is available for templates as well, via style filter.

Example:

import gluetool

gluetool.log.Logging.create_logger()
gluetool.color.switch(True)

print gluetool.utils.render_template('{{ "foo" | style(fg="red", bg="green") }}')

See also

Rendering templates
for more information about rendering templates with gluetool.