diff options
Diffstat (limited to 'pygments/formatters/terminal.py')
-rw-r--r-- | pygments/formatters/terminal.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/pygments/formatters/terminal.py b/pygments/formatters/terminal.py index 4d6debd9..661031e7 100644 --- a/pygments/formatters/terminal.py +++ b/pygments/formatters/terminal.py @@ -51,22 +51,26 @@ TERMINAL_COLORS = { class TerminalFormatter(Formatter): - """ - Output plain text with coloring ANSI sequences. - """ + r""" + Formats tokens with ANSI color sequences, for output in a text console. + Color sequences are terminated at newlines, so that paging the output + works correctly. - def __init__(self, **options): - """ - Accepted options: + 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. + `bg` + Set to ``"light"`` or ``"dark"`` depending on the terminal's background + (default: ``"light"``). - ``colorscheme`` - ``None`` or a dictionary mapping token types to - ``(lightbg, darkbg)`` color names. - """ + `colorscheme` + A dictionary mapping token types to (lightbg, darkbg) color names or + ``None`` (default: ``None`` = use builtin colorscheme). + """ + + def __init__(self, **options): Formatter.__init__(self, **options) self.darkbg = options.get('bg', 'light') == 'dark' self.colorscheme = options.get('colorscheme', None) or TERMINAL_COLORS |