If a color code is double-digit, make sure it's 0-15, not just 0-20
This commit is contained in:
parent
231fa51129
commit
f93e3f927f
1 changed files with 6 additions and 5 deletions
|
@ -157,12 +157,13 @@ def _color_tokens(s: str) -> typing.List[str]:
|
||||||
|
|
||||||
for char in s:
|
for char in s:
|
||||||
if is_color:
|
if is_color:
|
||||||
can_add = True
|
can_add = char.isdigit()
|
||||||
|
if can_add:
|
||||||
current_color = background if is_background else foreground
|
current_color = background if is_background else foreground
|
||||||
if current_color:
|
if current_color:
|
||||||
can_add = int(current_color) < 2
|
can_add = int(current_color) < 2 and int(char) < 6
|
||||||
|
|
||||||
if char.isdigit() and can_add:
|
if can_add:
|
||||||
if is_background:
|
if is_background:
|
||||||
background += char
|
background += char
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue