Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.

Commit 3663b8f

Browse files
committed
Convert from registry values into a usable Themes.ini file
1 parent e7f4160 commit 3663b8f

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

extract_from_registry/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Themes.ini
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env python
2+
3+
# Transform extracted color information into a suitable Themes.ini for
4+
# the CSS.
5+
6+
import configparser
7+
8+
origcolors = configparser.ConfigParser()
9+
origcolors.read("colors.ini")
10+
11+
# file to be written out
12+
themes = configparser.ConfigParser()
13+
14+
# Not handled by the extracter... hardcoding values here
15+
fonts = {
16+
"font_family": "Tahoma, Arial, Liberation Sans, sans-serif",
17+
"font_size": "12px",
18+
"font_line": "1.2",
19+
"font_size_text": "14px",
20+
"font_line_text": "1.2",
21+
"font_size_bigger": "13px",
22+
"font_size_header": "14px",
23+
}
24+
25+
# Mapping to items currently handled
26+
27+
# Q: Where do color_button_checked and color_hover come from?
28+
29+
items = {
30+
"ButtonText": "color_button_text",
31+
"ButtonFace": "color_button_face",
32+
"ButtonHilight": "color_button_highlight",
33+
"ButtonShadow": "color_button_shadow",
34+
"ButtonDkShadow": "color_button_shadow_dark",
35+
"WindowText": "color_window_text",
36+
"Window": "color_window",
37+
"TitleText": "color_active_caption_text",
38+
"ActiveTitle": "color_active_caption",
39+
"GradientActiveTitle": "color_active_caption_gradient",
40+
"InfoWindow": "color_info_background",
41+
"HilightText": "color_highlight_text",
42+
"Hilight": "color_highlight",
43+
"GrayText": "color_gray_text",
44+
"HotTrackingColor": "color_link",
45+
}
46+
47+
for section in origcolors.sections():
48+
themes[section] = {
49+
"color_button_checked": "223, 223, 223",
50+
"color_hover": "223, 223, 255",
51+
}
52+
themes[section].update(fonts)
53+
54+
for oldkey, newkey in items.items():
55+
themes[section][newkey] = origcolors[section][oldkey]
56+
57+
with open("Themes.ini", "w") as cfgfile:
58+
themes.write(cfgfile)

0 commit comments

Comments
 (0)