webconfig: Teach set_color short options

Since we now have .theme files we can't rely on it being normalized.
This commit is contained in:
Fabian Homborg 2021-12-13 21:39:52 +01:00
parent ba0b7133ad
commit 5a46a61ffb

View File

@ -197,21 +197,29 @@ def parse_color(color_str):
for comp in comps:
# Remove quotes
comp = comp.strip("'\" ")
if comp == "--bold":
if comp == "--bold" or comp == "-o":
bold = True
elif comp == "--underline":
elif comp == "--underline" or comp == "-u":
underline = True
elif comp == "--italics":
elif comp == "--italics" or comp == "-i":
italics = True
elif comp == "--dim":
elif comp == "--dim" or comp == "-d":
dim = True
elif comp == "--reverse":
elif comp == "--reverse" or comp == "-r":
reverse = True
elif comp.startswith("--background="):
elif comp.startswith("--background"):
# Background color
background_color = better_color(
background_color, parse_one_color(comp[len("--background=") :])
)
elif comp.startswith("-b"):
# Background color in short.
skip = len("-b")
if comp[len("-b=")] in ["=", " "]:
skip += 1
background_color = better_color(
background_color, parse_one_color(comp[skip :])
)
else:
# Regular color
color = better_color(color, parse_one_color(comp))