2 pygments.formatters.irc
3 ~~~~~~~~~~~~~~~~~~~~~~~
5 Formatter for IRC output
7 :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
8 :license: BSD, see LICENSE for details.
13 Number, Operator, Generic, Token, Whitespace
17__all__ = [
'IRCFormatter']
25 Whitespace: (
'gray',
'brightblack'),
26 Comment: (
'gray',
'brightblack'),
28 Keyword: (
'blue',
'brightblue'),
40 Name.Tag: (
'brightblue',
'brightblue'),
41 String: (
'yellow',
'yellow'),
42 Number: (
'blue',
'brightblue'),
50 Error: (
'_brightred_',
'_brightred_'),
91 add +=
'\x03' + str(IRC_COLOR_MAP[color]).
zfill(2)
93 return add + text + sub
94 return '<'+add+
'>'+text+
'</'+sub+
'>'
99 Format tokens with IRC color sequences
101 The `get_style_defs()` method doesn't do anything special since there is
102 no support for common styles.
107 Set to ``"light"`` or ``"dark"`` depending on the terminal's background
108 (default: ``"light"``).
111 A dictionary mapping token types to (lightbg, darkbg) color names or
112 ``None`` (default: ``None`` = use builtin colorscheme).
115 Set to ``True`` to have line numbers in the output as well
116 (default: ``False`` = no line numbers).
119 aliases = [
'irc',
'IRC']
124 self.
darkbg = get_choice_opt(options,
'bg',
125 [
'light',
'dark'],
'light') ==
'dark'
138 for ttype, value
in tokensource:
144 color = color[self.
darkbg]
146 for line
in spl[:-1]: