Coding style.

- Add xterm colors, and func for finding closest color, to
  termstr.py.
- Remove termstr's dependencies on pygments and ColorMap.py.
This commit is contained in:
Andrew Hamilton 2021-11-10 23:58:59 +10:00
parent b62afb5e69
commit 27fc9a433c
5 changed files with 35 additions and 150 deletions

View file

@ -174,9 +174,9 @@ def highlight_str(line, highlight_color, transparency):
@functools.lru_cache()
def blend_style(style):
fg_color = (style.fg_color if type(style.fg_color) == tuple
else termstr.xterm_color_to_rgb(style.fg_color))
else termstr.XTERM_COLORS[style.fg_color])
bg_color = (style.bg_color if type(style.bg_color) == tuple
else termstr.xterm_color_to_rgb(style.bg_color))
else termstr.XTERM_COLORS[style.bg_color])
return termstr.CharStyle(
blend_color(fg_color, highlight_color, transparency),
blend_color(bg_color, highlight_color, transparency),