1 | import configparser |
---|
2 | from pathlib import Path |
---|
3 | |
---|
4 | BRIGHT_COLORS = ( |
---|
5 | "gray", |
---|
6 | "brightred", |
---|
7 | "brightgreen", |
---|
8 | "yellow", |
---|
9 | "brightblue", |
---|
10 | "brightmagenta", |
---|
11 | "brightcyan", |
---|
12 | "white", |
---|
13 | ) |
---|
14 | |
---|
15 | INPUT_FILE = "../misc/skins/default.ini" |
---|
16 | |
---|
17 | config = configparser.ConfigParser() |
---|
18 | config.read(INPUT_FILE) |
---|
19 | |
---|
20 | for section in config.sections(): |
---|
21 | bold_default = False |
---|
22 | for key in config[section].keys(): |
---|
23 | fg_color, bg_color, style, *_ = config[section][key].split(";") + [None, None] |
---|
24 | if "bold" not in config[section][key]: |
---|
25 | if fg_color in BRIGHT_COLORS: |
---|
26 | config[section][key] += ";bold" |
---|
27 | if key == "_default_": |
---|
28 | bold_default = True |
---|
29 | elif bold_default and style is None: |
---|
30 | config[section][key] += ";+" |
---|
31 | |
---|
32 | with open(INPUT_FILE, "w") as f: |
---|
33 | config.write(f) |
---|
34 | |
---|
35 | Path(INPUT_FILE).write_text( |
---|
36 | "\n".join([ |
---|
37 | " " + line.strip() if not line.startswith("[") and line.strip() else line |
---|
38 | for line in Path(INPUT_FILE).read_text().splitlines() |
---|
39 | ]) |
---|
40 | ) |
---|