class documentation

class TerminalFormatter(Formatter): (source)

View In Hierarchy

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: `bg` Set to ``"light"`` or ``"dark"`` depending on the terminal's background (default: ``"light"``). `colorscheme` A dictionary mapping token types to (lightbg, darkbg) color names or ``None`` (default: ``None`` = use builtin colorscheme). `linenos` Set to ``True`` to have line numbers on the terminal output as well (default: ``False`` = no line numbers).

Method __init__ Undocumented
Method format Format ``tokensource``, an iterable of ``(tokentype, tokenstring)`` tuples and write it into ``outfile``.
Method format_unencoded Undocumented
Class Variable aliases Undocumented
Class Variable filenames Undocumented
Class Variable name Undocumented
Instance Variable colorscheme Undocumented
Instance Variable darkbg Undocumented
Instance Variable linenos Undocumented
Method _get_color Undocumented
Method _write_lineno Undocumented
Instance Variable _lineno Undocumented

Inherited from Formatter:

Method get_style_defs Return the style definitions for the current style as a string.
Class Variable unicodeoutput Undocumented
Instance Variable encoding Undocumented
Instance Variable full Undocumented
Instance Variable options Undocumented
Instance Variable style Undocumented
Instance Variable title Undocumented
def __init__(self, **options): (source)

Undocumented

def format(self, tokensource, outfile): (source)

Format ``tokensource``, an iterable of ``(tokentype, tokenstring)`` tuples and write it into ``outfile``.

def format_unencoded(self, tokensource, outfile): (source)

Undocumented

colorscheme = (source)

Undocumented

Undocumented

Undocumented

def _get_color(self, ttype): (source)

Undocumented

def _write_lineno(self, outfile): (source)

Undocumented

Undocumented