aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jesopo2018-11-14 12:12:32 +0000
committerGravatar jesopo2018-11-14 12:13:08 +0000
commit0e499a40784425c9577469ff7ab0e727d01bbe6e (patch)
tree2c0f67c8fa74049da73f8d6ab814e39b0252a45f /src
parentUse extended ANSI colors to avoid using bold to make colors lighter (diff)
signature
Support irc format full reset (\x0F) as ansi reset (\033[0m)
Diffstat (limited to 'src')
-rw-r--r--src/utils/irc.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/utils/irc.py b/src/utils/irc.py
index af103d6f..4a99caca 100644
--- a/src/utils/irc.py
+++ b/src/utils/irc.py
@@ -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)