Coding style.
Linting.
This commit is contained in:
parent
cbba46d5c0
commit
a3c0a69076
4 changed files with 11 additions and 10 deletions
9
tools.py
9
tools.py
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue