Start work on easily generating ANSI formatted strings

This commit is contained in:
Kovid Goyal
2022-11-14 15:41:53 +05:30
parent fb482e28f6
commit 91c61478dd
4 changed files with 373 additions and 1 deletions
Generated
+1 -1
View File
@@ -66,7 +66,7 @@ def to_color(raw: str, validate: bool = False) -> Optional[Color]:
with suppress(Exception):
if raw.startswith('#'):
val = parse_sharp(raw[1:])
elif raw[:4].lower() == 'rgb:':
elif raw.startswith('rgb:'):
val = parse_rgb(raw[4:])
if val is None and validate:
raise ValueError(f'Invalid color name: {raw}')