diff --git a/src/utils/irc.py b/src/utils/irc.py index 2d7663e0..09944a6f 100644 --- a/src/utils/irc.py +++ b/src/utils/irc.py @@ -157,12 +157,13 @@ def _color_tokens(s: str) -> typing.List[str]: for char in s: if is_color: - can_add = True - current_color = background if is_background else foreground - if current_color: - can_add = int(current_color) < 2 + can_add = char.isdigit() + if can_add: + current_color = background if is_background else foreground + if current_color: + can_add = int(current_color) < 2 and int(char) < 6 - if char.isdigit() and can_add: + if can_add: if is_background: background += char else: