Support irc format full reset (\x0F) as ansi reset (\033[0m)
This commit is contained in:
parent
bbcde2d1d5
commit
0e499a4078
1 changed files with 7 additions and 1 deletions
|
@ -144,6 +144,10 @@ def strip_font(s: str) -> str:
|
|||
s = s.replace(utils.consts.COLOR, "")
|
||||
return s
|
||||
|
||||
FORMAT_TOKENS = [
|
||||
utils.consts.BOLD,
|
||||
utils.consts.RESET
|
||||
]
|
||||
def _color_tokens(s: str) -> typing.List[str]:
|
||||
is_color = False
|
||||
foreground = ""
|
||||
|
@ -172,7 +176,7 @@ def _color_tokens(s: str) -> typing.List[str]:
|
|||
matches.append(char)
|
||||
else:
|
||||
is_color = True
|
||||
elif char == utils.consts.BOLD:
|
||||
elif char in FORMAT_TOKENS:
|
||||
matches.append(char)
|
||||
return matches
|
||||
|
||||
|
@ -215,6 +219,8 @@ def to_ansi_colors(s: str) -> str:
|
|||
else:
|
||||
replace += utils.consts.ANSI_BOLD
|
||||
bold = not bold
|
||||
elif type == utils.consts.RESET:
|
||||
resplace += utils.consts.ANSI_RESET
|
||||
|
||||
s = s.replace(token, replace, 1)
|
||||
|
||||
|
|
Loading…
Reference in a new issue