Formatter for terminal output with ANSI sequences.

copyright:Copyright 2006-2013 by the Pygments team, see AUTHORS.
license:BSD, see LICENSE for details.
class pygments.formatters.terminal.TerminalFormatter(**options)[source]

Format tokens with ANSI color sequences, for output in a text console. Color sequences are terminated at newlines, so that paging the output works correctly.

The get_style_defs() method doesn’t do anything special since there is no support for common styles.

Options accepted:

Set to "light" or "dark" depending on the terminal’s background (default: "light").
A dictionary mapping token types to (lightbg, darkbg) color names or None (default: None = use builtin colorscheme).

Project Versions

This Page