Generate correct html from xterm colors.
This commit is contained in:
parent
28b2c9bae9
commit
9ecc65bd12
2 changed files with 3 additions and 4 deletions
|
|
@ -147,9 +147,9 @@ class CharStyle:
|
||||||
underline_code = ("text-decoration:underline; "
|
underline_code = ("text-decoration:underline; "
|
||||||
if self.is_underlined else "")
|
if self.is_underlined else "")
|
||||||
fg_color = (self.fg_color if type(self.fg_color) == tuple
|
fg_color = (self.fg_color if type(self.fg_color) == tuple
|
||||||
else xterm_colors[self.fg_color])
|
else XTERM_COLORS[self.fg_color])
|
||||||
bg_color = (self.bg_color if type(self.bg_color) == tuple
|
bg_color = (self.bg_color if type(self.bg_color) == tuple
|
||||||
else xterm_colors[self.bg_color])
|
else XTERM_COLORS[self.bg_color])
|
||||||
return (f"<style>.S{id(self)} {{font-size:80%%; color:rgb{fg_color!r};"
|
return (f"<style>.S{id(self)} {{font-size:80%%; color:rgb{fg_color!r};"
|
||||||
f" background-color:rgb{bg_color!r}; "
|
f" background-color:rgb{bg_color!r}; "
|
||||||
f"{bold_code}{italic_code}{underline_code}}}</style>")
|
f"{bold_code}{italic_code}{underline_code}}}</style>")
|
||||||
|
|
@ -212,7 +212,7 @@ class TermStr(collections.UserString):
|
||||||
is_italic = True
|
is_italic = True
|
||||||
elif code in ["04", "4"]: # underline
|
elif code in ["04", "4"]: # underline
|
||||||
is_underlined = True
|
is_underlined = True
|
||||||
elif code_int and 30 <= code_int <= 37 : # dim fg color
|
elif code_int and 30 <= code_int <= 37: # dim fg color
|
||||||
fg_color = int(code[1])
|
fg_color = int(code[1])
|
||||||
elif code_int and 40 <= code_int <= 47: # dim bg color
|
elif code_int and 40 <= code_int <= 47: # dim bg color
|
||||||
bg_color = int(code[1])
|
bg_color = int(code[1])
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env python3.9
|
#!/usr/bin/env python3.9
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
import pickle
|
import pickle
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue