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

Commit 8413bb8

Browse files
committed
Add support for generating CSSes from a base.css and Themes.ini
1 parent fd78f71 commit 8413bb8

File tree

3 files changed

+126
-24
lines changed

3 files changed

+126
-24
lines changed

Themes.ini

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
[Windows 95]
2+
color_button_text = 0, 0, 0
3+
color_button_face = 192, 192, 192
4+
color_button_highlight = 255, 255, 255
5+
color_button_shadow = 128, 128, 128
6+
color_button_shadow_dark = 0, 0, 0
7+
color_button_checked = 223, 223, 223
8+
color_window_text = 0, 0, 0
9+
color_window = 255, 255, 255
10+
color_active_caption_text = 255, 255, 255
11+
color_active_caption = 0, 0, 128
12+
color_active_caption_gradient = 0, 0, 128
13+
color_info_background = 255, 255, 192
14+
color_highlight_text = 255, 255, 255
15+
color_highlight = 0, 0, 128
16+
color_gray_text = 128, 128, 128
17+
color_link = 0, 0, 128
18+
color_hover = 223, 223, 255
19+
20+
font_family = MS Sans Serif, MS Reference Sans Serif, Arial, Liberation Sans, sans-serif
21+
font_size = 12px
22+
font_line = 1.2
23+
font_size_text = 14px
24+
font_line_text = 1.2
25+
font_size_bigger = 13px
26+
font_size_header = 14px
27+
28+
[Windows 98]
29+
color_button_text = 0, 0, 0
30+
color_button_face = 192, 192, 192
31+
color_button_highlight = 255, 255, 255
32+
color_button_shadow = 128, 128, 128
33+
color_button_shadow_dark = 0, 0, 0
34+
color_button_checked = 223, 223, 223
35+
color_window_text = 0, 0, 0
36+
color_window = 255, 255, 255
37+
color_active_caption_text = 255, 255, 255
38+
color_active_caption = 0, 0, 128
39+
color_active_caption_gradient = 16, 132, 208
40+
color_info_background = 255, 255, 192
41+
color_highlight_text = 255, 255, 255
42+
color_highlight = 0, 0, 128
43+
color_gray_text = 128, 128, 128
44+
color_link = 0, 0, 128
45+
color_hover = 223, 223, 255
46+
47+
font_family = MS Sans Serif, MS Reference Sans Serif, Arial, Liberation Sans, sans-serif
48+
font_size = 12px
49+
font_line = 1.2
50+
font_size_text = 14px
51+
font_line_text = 1.2
52+
font_size_bigger = 13px
53+
font_size_header = 14px
54+
55+
[Windows 2000]
56+
color_button_text = 0, 0, 0
57+
color_button_face = 212, 208, 200
58+
color_button_highlight = 255, 255, 255
59+
color_button_shadow = 128, 128, 128
60+
color_button_shadow_dark = 64, 64, 64
61+
color_button_checked = 223, 223, 223
62+
color_window_text = 0, 0, 0
63+
color_window = 255, 255, 255
64+
color_active_caption_text = 255, 255, 255
65+
color_active_caption = 10, 36, 106
66+
color_active_caption_gradient = 166, 202, 240
67+
color_info_background = 255, 255, 225
68+
color_highlight_text = 255, 255, 255
69+
color_highlight = 10, 36, 106
70+
color_gray_text = 128, 128, 128
71+
color_link = 0, 0, 200
72+
color_hover = 223, 223, 255
73+
74+
font_family = Tahoma, Arial, Liberation Sans, sans-serif
75+
font_size = 12px
76+
font_line = 1.2
77+
font_size_text = 14px
78+
font_line_text = 1.2
79+
font_size_bigger = 13px
80+
font_size_header = 14px

GitHubWindows.user.css renamed to base.css

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,32 @@
1010

1111
@-moz-document domain("github.com") {
1212
:root {
13-
--color-button-text: rgb(0, 0, 0);
14-
--color-button-face: rgb(192, 192, 192);
15-
--color-button-highlight: rgb(255, 255, 255);
16-
--color-button-shadow: rgb(128, 128, 128);
17-
--color-button-shadow-dark: rgb(0, 0, 0);
18-
--color-button-checked: rgb(223, 223, 223);
19-
--color-window-text: rgb(0, 0, 0);
20-
--color-window: rgb(255, 255, 255);
21-
--color-active-caption-text: rgb(255, 255, 255);
22-
--color-active-caption: rgb(0, 0, 128);
23-
--color-active-caption-gradient: rgb(0, 0, 128);
24-
--color-info-background: rgb(255, 255, 192);
25-
--color-highlight-text: rgb(255, 255, 255);
26-
--color-highlight: rgb(0, 0, 128);
27-
--color-gray-text: rgb(128, 128, 128);
28-
--color-link: rgb(0, 0, 255);
29-
--color-hover: rgb(223, 223, 255);
13+
--color-button-text: __color_button_text__;
14+
--color-button-face: __color_button_face__;
15+
--color-button-highlight: __color_button_highlight__;
16+
--color-button-shadow: __color_button_shadow__;
17+
--color-button-shadow-dark: __color_button_shadow_dark__;
18+
--color-button-checked: __color_button_checked__;
19+
--color-window-text: __color_window_text__;
20+
--color-window: __color_window__;
21+
--color-active-caption-text: __color_active_caption_text__;
22+
--color-active-caption: __color_active_caption__;
23+
--color-active-caption-gradient: __color_active_caption_gradient__;
24+
--color-info-background: __color_info_background__;
25+
--color-highlight-text: __color_highlight_text__;
26+
--color-highlight: __color_highlight__;
27+
--color-gray-text: __color_gray_text__;
28+
--color-link: __color_link__;
29+
--color-hover: __color_hover__;
3030

31-
--font-family: MS Sans Serif, MS Reference Sans Serif, Liberation Sans, Tahoma, sans-serif;
32-
--font-size: 12px;
33-
--font-line: 1.2;
31+
--font-family: __font_family__;
32+
--font-size: __font_size__;
33+
--font-line: __font_line__;
3434
--font: var(--font-size)/var(--font-line) var(--font-family);
35-
--font-size-text: 14px;
36-
--font-line-text: 1.2;
37-
--font-size-bigger: 13px;
38-
--font-size-header: 14px;
35+
--font-size-text: __font_size_text__;
36+
--font-line-text: __font_line_text__;
37+
--font-size-bigger: __font_size_bigger__;
38+
--font-size-header: __font_size_header__;
3939
--font-text: var(--font-size-text)/var(--font-line-text) var(--font-family);
4040

4141
--button-3d-border-color-exact: var(--color-button-face) var(--color-button-shadow) var(--color-button-shadow) var(--color-button-face);

generate_themes.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
# SPDX-License-Identifier: MIT
3+
4+
import configparser
5+
6+
with open("base.css", "r") as f:
7+
base_css = f.read()
8+
9+
config = configparser.ConfigParser()
10+
config.read("Themes.ini")
11+
12+
for theme in config.sections():
13+
css = base_css
14+
15+
for key in config[theme]:
16+
if key.startswith("color"):
17+
css = css.replace(f"__{key}__", f"rgb({config[theme][key]})")
18+
else:
19+
css = css.replace(f"__{key}__", f"{config[theme][key]}")
20+
21+
with open(f"Generated_Themes/{theme}.user.css", "w") as out:
22+
out.write(css)

0 commit comments

Comments
 (0)