aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar jesopo2018-12-12 11:49:42 +0000
committerGravatar jesopo2018-12-12 11:49:42 +0000
commitd5467aefe9373ce3ebce04529464b3fdbd08f796 (patch)
treed63b662d7e450bd4649ab8869411cf579a597f3d /src/utils
parentPreserve logged exc_info across threads (diff)
signature
Support '99' as a 'transparent' irc color code
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/consts.py33
-rw-r--r--src/utils/irc.py3
2 files changed, 19 insertions, 17 deletions
diff --git a/src/utils/consts.py b/src/utils/consts.py
index cfb09243..56f6950d 100644
--- a/src/utils/consts.py
+++ b/src/utils/consts.py
@@ -19,22 +19,23 @@ def _color(name: str, irc: int, ansi: int, color_bold: bool):
COLOR_CODES[irc] = color
return color
-WHITE = _color("white", 0, 97, False)
-BLACK = _color("black", 1, 30, False)
-BLUE = _color("blue", 2, 34, False)
-GREEN = _color("green", 3, 32, False)
-RED = _color("red", 4, 91, False)
-BROWN = _color("brown", 5, 31, False)
-PURPLE = _color("purple", 6, 35, False)
-ORANGE = _color("orange", 7, 33, False)
-YELLOW = _color("yellow", 8, 93, False)
-LIGHTGREEN = _color("light green", 9, 92, False)
-CYAN = _color("cyan", 10, 36, False)
-LIGHTCYAN = _color("light cyan", 11, 96, False)
-LIGHTBLUE = _color("light blue", 12, 94, False)
-PINK = _color("pink", 13, 95, False)
-GREY = _color("grey", 14, 90, False)
-LIGHTGREY = _color("light grey", 15, 37, False)
+WHITE = _color("white", 0, 97, False)
+BLACK = _color("black", 1, 30, False)
+BLUE = _color("blue", 2, 34, False)
+GREEN = _color("green", 3, 32, False)
+RED = _color("red", 4, 91, False)
+BROWN = _color("brown", 5, 31, False)
+PURPLE = _color("purple", 6, 35, False)
+ORANGE = _color("orange", 7, 33, False)
+YELLOW = _color("yellow", 8, 93, False)
+LIGHTGREEN = _color("light green", 9, 92, False)
+CYAN = _color("cyan", 10, 36, False)
+LIGHTCYAN = _color("light cyan", 11, 96, False)
+LIGHTBLUE = _color("light blue", 12, 94, False)
+PINK = _color("pink", 13, 95, False)
+GREY = _color("grey", 14, 90, False)
+LIGHTGREY = _color("light grey", 15, 37, False)
+TRANSPARENT = _color("transparent", 99, 39, False)
BOLD = "\x02"
ITALIC = "\x1D"
diff --git a/src/utils/irc.py b/src/utils/irc.py
index e1021587..1d688226 100644
--- a/src/utils/irc.py
+++ b/src/utils/irc.py
@@ -163,7 +163,8 @@ def _color_tokens(s: str) -> typing.List[str]:
if can_add:
current_color = background if is_background else foreground
if current_color:
- can_add = int(current_color + char) <= 15
+ next_color = int(current_color + char)
+ can_add = next_color <= 15 or next_color = 99
if can_add:
if is_background: