class documentation

class TerminalFormatter(Formatter):

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 ​_get​_color Undocumented
Method ​_write​_lineno 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 ​_lineno Undocumented
Instance Variable colorscheme Undocumented
Instance Variable darkbg Undocumented
Instance Variable linenos 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):

Undocumented

def _get_color(self, ttype):

Undocumented

def _write_lineno(self, outfile):

Undocumented

def format(self, tokensource, outfile):
Format tokensource, an iterable of (tokentype, tokenstring) tuples and write it into outfile.
def format_unencoded(self, tokensource, outfile):

Undocumented

aliases: list[str] =

Undocumented

filenames: list =
name: str =

Undocumented

_lineno: int =

Undocumented

colorscheme =

Undocumented

darkbg =

Undocumented

linenos =

Undocumented