Coding style.

Linting.
This commit is contained in:
Andrew Hamilton 2016-02-18 22:34:46 +00:00
parent cbba46d5c0
commit a3c0a69076
4 changed files with 11 additions and 10 deletions

View file

@ -128,6 +128,7 @@ def _syntax_highlight(text, lexer, style):
if hex_rgb.startswith("#"):
hex_rgb = hex_rgb[1:]
return tuple(eval("0x"+hex_rgb[index:index+2]) for index in [0, 2, 4])
def _char_style_for_token_type(token_type, default_bg_color):
token_style = style.style_for_token(token_type)
fg_color = (None if token_style["color"] is None
@ -138,10 +139,10 @@ def _syntax_highlight(text, lexer, style):
token_style["italic"],
token_style["underline"])
default_bg_color = _parse_rgb(style.background_color)
text = fill3.join("",
[termstr.TermStr(text, _char_style_for_token_type(token_type,
default_bg_color))
for token_type, text in pygments.lex(text, lexer)])
text = fill3.join(
"", [termstr.TermStr(text, _char_style_for_token_type(
token_type, default_bg_color))
for token_type, text in pygments.lex(text, lexer)])
return fill3.Text(text, pad_char=termstr.TermStr(" ").bg_color(
default_bg_color))