7 :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
8 :license: BSD, see LICENSE for details.
16 'ansiblack':
'000000',
18 'ansigreen':
'007f00',
19 'ansiyellow':
'7f7fe0',
21 'ansimagenta':
'7f007f',
25 'ansibrightblack':
'555555',
26 'ansibrightred':
'ff0000',
27 'ansibrightgreen':
'00ff00',
28 'ansibrightyellow':
'ffff00',
29 'ansibrightblue':
'0000ff',
30 'ansibrightmagenta':
'ff00ff',
31 'ansibrightcyan':
'00ffff',
32 'ansiwhite':
'ffffff',
35_deprecated_ansicolors = {
37 '#ansiblack':
'ansiblack',
38 '#ansidarkred':
'ansired',
39 '#ansidarkgreen':
'ansigreen',
40 '#ansibrown':
'ansiyellow',
41 '#ansidarkblue':
'ansiblue',
42 '#ansipurple':
'ansimagenta',
43 '#ansiteal':
'ansicyan',
44 '#ansilightgray':
'ansigray',
46 '#ansidarkgray':
'ansibrightblack',
47 '#ansired':
'ansibrightred',
48 '#ansigreen':
'ansibrightgreen',
49 '#ansiyellow':
'ansibrightyellow',
50 '#ansiblue':
'ansibrightblue',
51 '#ansifuchsia':
'ansibrightmagenta',
52 '#ansiturquoise':
'ansibrightcyan',
53 '#ansiwhite':
'ansiwhite',
55ansicolors = set(_ansimap)
62 for token
in STANDARD_TYPES:
67 if text
in ansicolors:
74 return col[0] * 2 + col[1] * 2 + col[2] * 2
79 assert False,
"wrong color format %r" % text
89 if not ndef
or token
is None:
90 ndef = [
'', 0, 0, 0,
'',
'', 0, 0, 0]
91 elif 'noinherit' in styledefs
and token
is not Token:
92 ndef = _styles[Token][:]
97 if styledef ==
'noinherit':
99 elif styledef ==
'bold':
101 elif styledef ==
'nobold':
103 elif styledef ==
'italic':
105 elif styledef ==
'noitalic':
107 elif styledef ==
'underline':
109 elif styledef ==
'nounderline':
111 elif styledef[:3] ==
'bg:':
113 elif styledef[:7] ==
'border:':
115 elif styledef ==
'roman':
117 elif styledef ==
'sans':
119 elif styledef ==
'mono':
128 ansicolor = bgansicolor =
None
130 if color
in _deprecated_ansicolors:
131 color = _deprecated_ansicolors[color]
132 if color
in ansicolors:
134 color = _ansimap[color]
136 if bgcolor
in _deprecated_ansicolors:
137 bgcolor = _deprecated_ansicolors[bgcolor]
138 if bgcolor
in ansicolors:
139 bgansicolor = bgcolor
140 bgcolor = _ansimap[bgcolor]
143 'color': color
or None,
145 'italic': bool(t[2]),
146 'underline': bool(t[3]),
147 'bgcolor': bgcolor
or None,
148 'border': t[5]
or None,
149 'roman': bool(t[6])
or None,
150 'sans': bool(t[7])
or None,
151 'mono': bool(t[8])
or None,
152 'ansicolor': ansicolor,
153 'bgansicolor': bgansicolor,
173 background_color =
'#ffffff'
176 highlight_color =
'#ffffcc'
179 line_number_color =
'inherit'
182 line_number_background_color =
'transparent'
185 line_number_special_color =
'#000000'
188 line_number_special_background_color =
'#ffffc0'
197 web_style_gallery_exclude =
False