in doc/bst2html.py [0:0]
def _ansi2html_get_styles(palette):
if palette not in _ANSI2HTML_STYLES:
p = ANSI2HTML_PALETTE.get(palette, ANSI2HTML_PALETTE['console'])
regular_style = {
'1': '', # bold
'2': 'opacity:0.5',
'4': 'text-decoration:underline',
'5': 'font-weight:bold',
'7': '',
'8': 'display:none',
}
bold_style = regular_style.copy()
for i in range(8):
regular_style['3%s' % i] = 'color:%s' % p[i]
regular_style['4%s' % i] = 'background-color:%s' % p[i]
bold_style['3%s' % i] = 'color:%s' % p[i + 8]
bold_style['4%s' % i] = 'background-color:%s' % p[i + 8]
# The default xterm 256 colour p:
indexed_style = {}
for i in range(16):
indexed_style['%s' % i] = p[i]
for rr in range(6):
for gg in range(6):
for bb in range(6):
i = 16 + rr * 36 + gg * 6 + bb
r = (rr * 40 + 55) if rr else 0
g = (gg * 40 + 55) if gg else 0
b = (bb * 40 + 55) if bb else 0
indexed_style['%s' % i] = ''.join('%02X' % c if 0 <= c <= 255 else None for c in (r, g, b))
for g in range(24):
i = g + 232
L = g * 10 + 8
indexed_style['%s' % i] = ''.join('%02X' % c if 0 <= c <= 255 else None for c in (L, L, L))
_ANSI2HTML_STYLES[palette] = (regular_style, bold_style, indexed_style)
return _ANSI2HTML_STYLES[palette]