pygments.formatters.terminal256

Formatter for 256-color terminal output with ANSI sequences.

RGB-to-XTERM color conversion routines adapted from xterm256-conv tool (http://frexx.de/xterm-256-notes/data/xterm256-conv2.tar.bz2) by Wolfgang Frisch.

Formatter version 1.

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

Format tokens with ANSI color sequences, for output in a 256-color terminal or console. Like in TerminalFormatter color sequences are terminated at newlines, so that paging the output works correctly.

The formatter takes colors from a style defined by the style option and converts them to nearest ANSI 256-color escape sequences. Bold and underline attributes from the style are preserved (and displayed).

New in Pygments 0.9.

Options accepted:

style
The style to use, can be a string or a Style subclass (default: 'default').

Project Versions

This Page