Skip to content

Commit 2ed9d6f

Browse files
committed
Accept ideas behind pull #57 to modularize and reogranize theme management
1 parent ec5d7d2 commit 2ed9d6f

3 files changed

Lines changed: 336 additions & 0 deletions

File tree

tcl/themes/cobalt2.tcl

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
registerDarkTheme "cobalt2"
2+
3+
# Create a custom "cobalt2" theme inspired by Wes Bos's popular VSCode theme
4+
if {[lsearch -exact [ttk::style theme names] cobalt2] == -1} {
5+
ttk::style theme create cobalt2 -parent classic -settings {
6+
# Cobalt2 theme - dark blue theme inspired by Wes Bos's VSCode theme
7+
# Color palette: Blue #193549, Blue Dark #122738, Highlight #1F4662, Yellow #ffc600, Hot Pink #ff0088, Orange #ff9d00
8+
# Base/UI background and text
9+
ttk::style configure . \
10+
-background #193549 \
11+
-fieldbackground #122738 \
12+
-foreground #ffffff \
13+
-selectbackground #1F4662 \
14+
-selectforeground #ffc600
15+
ttk::style configure TFrame -background #193549
16+
ttk::style configure TLabel -background #193549 -foreground #ffffff
17+
ttk::style configure TNotebook -background #193549
18+
# Content windows (Tree view, Game List, PGN text via applyThemeStyle)
19+
ttk::style configure Treeview -background #122738 -fieldbackground #122738 -foreground #ffffff
20+
ttk::style map Treeview \
21+
-background [list selected #1F4662] \
22+
-foreground [list selected #ffc600]
23+
# Inputs
24+
ttk::style configure TEntry -fieldbackground #122738 -foreground #ffc600
25+
ttk::style configure TCombobox -fieldbackground #122738 -foreground #ffc600
26+
# Buttons
27+
ttk::style configure TButton -background #1F4662 -foreground #ffc600 -borderwidth 1 -relief raised -padding {6 2}
28+
ttk::style map TButton -background [list active #234E6D pressed #122738] -relief [list pressed sunken]
29+
# Menubuttons
30+
ttk::style configure TMenubutton -background #1F4662 -foreground #ffc600 -borderwidth 1 -relief raised
31+
# Checkboxes and radiobuttons: explicit indicator colors for visibility
32+
ttk::style configure TCheckbutton -background #193549 -foreground #ffffff -indicatorcolor #122738
33+
ttk::style map TCheckbutton \
34+
-background [list active #193549] \
35+
-indicatorcolor [list pressed #122738 selected #ff9d00 alternate #ff9d00]
36+
ttk::style configure TRadiobutton -background #193549 -foreground #ffffff -indicatorcolor #122738
37+
ttk::style map TRadiobutton \
38+
-background [list active #193549] \
39+
-indicatorcolor [list pressed #122738 selected #ff9d00 alternate #ff9d00]
40+
}
41+
}

tcl/themes/dark.tcl

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
registerDarkTheme "dark"
2+
3+
#
4+
# Copyright (C) 2020 Uwe Klimmek
5+
#
6+
# This file is part of Scid (Shane's Chess Information Database).
7+
# Scid is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation.
10+
11+
### Implements a "dark" theme.
12+
13+
namespace eval ttk::theme::dark {
14+
array set colors {
15+
background "#323232"
16+
foreground "#e0e0e0"
17+
disabledfg "#a0a0a0"
18+
buttonbg "#3b3b3e"
19+
buttonbgdark "#2b2b2e"
20+
buttonbglight "#4b4b4e"
21+
labelframe "#a5a6a9"
22+
fieldbg "#1e1e1e"
23+
fieldborder "#292929"
24+
darkcolor "#222222"
25+
lightcolor "#656669"
26+
notebookborder "#555659"
27+
selectbg "#555659"
28+
selectfg "#ffffff"
29+
through "#353639"
30+
}
31+
32+
ttk::style theme create dark -parent clam -settings {
33+
set basecol DodgerBlue3 ;# Alternative: #3b6dce Basecolor, change here to have new topic for the theme
34+
# -----------------------------------------------------------------------------
35+
# Theme defaults
36+
ttk::style configure "." \
37+
-foreground $colors(foreground) \
38+
-background $colors(background) \
39+
-darkcolor $colors(darkcolor) \
40+
-lightcolor $colors(lightcolor) \
41+
-troughcolor $colors(through) \
42+
-selectbackground $basecol \
43+
-selectforeground $colors(selectfg) \
44+
-activebackground $basecol \
45+
-activeforeground $colors(selectfg) \
46+
-indicatorbackground $colors(fieldbg) \
47+
-indicatorforeground $colors(foreground) \
48+
-fieldbackground $colors(fieldbg) \
49+
-bordercolor $colors(fieldborder) \
50+
-selectborderwidth 0 \
51+
-arrowcolor $colors(foreground) \
52+
-insertcolor $colors(foreground) \
53+
-insertbackground $colors(foreground) \
54+
;
55+
56+
ttk::style map "." \
57+
-foreground [list \
58+
disabled $colors(disabledfg)] \
59+
-background [list \
60+
active $basecol] \
61+
-fieldbackground [list \
62+
disabled $colors(background)] \
63+
-indicatorbackground [list \
64+
pressed $colors(background) \
65+
alternate $colors(disabledfg) \
66+
disabled $colors(background)] \
67+
-indicatorforeground [list \
68+
disabled $colors(disabledfg)] \
69+
-arrowcolor [list \
70+
disabled $colors(disabledfg)] \
71+
;
72+
73+
set borders [list disabled $colors(fieldborder) {active pressed} $basecol \
74+
{disabled selected} $colors(fieldborder) {pressed selected} $basecol pressed $basecol \
75+
{active selected} $basecol active $basecol selected $basecol focus $basecol ]
76+
set buttonborder [list disabled $colors(fieldborder) {active pressed} $basecol \
77+
{disabled selected} $colors(fieldborder) {pressed selected} $basecol pressed $basecol \
78+
{active selected} $basecol active $basecol selected $basecol ]
79+
set buttonsbg [list disabled $colors(through) pressed $colors(buttonbgdark) \
80+
active $colors(buttonbglight) ]
81+
82+
ttk::style configure TButton \
83+
-anchor center \
84+
-relief raised \
85+
-padding 4 \
86+
-background $colors(buttonbg) \
87+
;
88+
ttk::style map TButton \
89+
-bordercolor $buttonborder \
90+
-background $buttonsbg \
91+
;
92+
93+
ttk::style configure TMenubutton \
94+
-anchor center \
95+
-padding 4 \
96+
-relief raised \
97+
-background $colors(buttonbg) \
98+
;
99+
ttk::style map TMenubutton \
100+
-bordercolor $borders \
101+
-background $buttonsbg \
102+
;
103+
104+
ttk::style configure Toolbutton \
105+
-anchor center \
106+
-padding 2 \
107+
-relief flat \
108+
;
109+
ttk::style map Toolbutton \
110+
-relief [list \
111+
{active !selected} raised] \
112+
-bordercolor $borders \
113+
-foreground [list \
114+
disabled $colors(disabledfg)] \
115+
-background [list \
116+
pressed $basecol \
117+
selected $basecol \
118+
active $colors(darkcolor)] \
119+
-lightcolor [list pressed $basecol] \
120+
-darkcolor [list pressed $basecol] \
121+
;
122+
123+
ttk::style configure TCheckbutton \
124+
-padding 2
125+
;
126+
ttk::style configure TRadiobutton \
127+
-padding 2
128+
;
129+
130+
ttk::style configure TCombobox \
131+
-anchor center \
132+
-padding 1 \
133+
-insertwidth 1 \
134+
-relief raised \
135+
-borderwidth 1 \
136+
;
137+
ttk::style map TCombobox \
138+
-bordercolor $borders \
139+
-background $buttonsbg \
140+
-lightcolor $borders \
141+
;
142+
143+
ttk::style configure TEntry \
144+
-foreground $colors(selectfg) \
145+
-padding 1 \
146+
-insertwidth 1 \
147+
;
148+
ttk::style map TEntry \
149+
-bordercolor $borders \
150+
-lightcolor $borders \
151+
;
152+
153+
ttk::style configure TSpinbox \
154+
-arrowsize 12 \
155+
-padding {2 0 10 0} \
156+
;
157+
ttk::style map TSpinbox \
158+
-bordercolor $borders \
159+
-background $buttonsbg \
160+
-arrowcolor [list \
161+
disabled $colors(disabledfg)] \
162+
;
163+
164+
ttk::style configure TScale \
165+
-troughcolor $colors(through) \
166+
;
167+
ttk::style map TScale \
168+
-bordercolor [list \
169+
active $basecol] \
170+
;
171+
172+
ttk::style configure TNotebook.Tab \
173+
-padding {6 2 6 2} \
174+
;
175+
ttk::style map TNotebook.Tab \
176+
-padding [list \
177+
selected {6 4 6 2}] \
178+
-background [list \
179+
selected $colors(background) \
180+
{} $colors(fieldbg)] \
181+
-lightcolor [list \
182+
selected $colors(lightcolor) \
183+
{} $colors(notebookborder)] \
184+
;
185+
186+
ttk::style configure TPanedwindow \
187+
-sashrelief raised \
188+
;
189+
190+
ttk::style configure TLabelframe \
191+
-bordercolor $colors(labelframe) \
192+
-relief raised \
193+
-padding 4 \
194+
;
195+
196+
ttk::style configure TProgressbar \
197+
-background $basecol \
198+
;
199+
200+
ttk::style configure TScrollbar \
201+
-arrowsize 10 -width 10 \
202+
-troughcolor $colors(fieldbg) \
203+
-bordercolor $colors(fieldbg) \
204+
-background $colors(through) \
205+
;
206+
ttk::style map TScrollbar \
207+
-background [list \
208+
pressed $colors(lightcolor) \
209+
active $colors(lightcolor) \
210+
disabled $colors(through) \
211+
!pressed $colors(buttonbglight)] \
212+
-lightcolor [list \
213+
pressed $colors(darkcolor) \
214+
active $colors(lightcolor) \
215+
disabled $colors(through) \
216+
!pressed $colors(buttonbglight)] \
217+
-darkcolor [list \
218+
pressed $colors(lightcolor) \
219+
active $colors(darkcolor) \
220+
disabled $colors(through) \
221+
!pressed $colors(buttonbglight)] \
222+
;
223+
# Remove arrows
224+
ttk::style layout Vertical.TScrollbar {
225+
Vertical.Scrollbar.trough -sticky news -children {
226+
Vertical.Scrollbar.thumb -expand true
227+
}
228+
}
229+
ttk::style layout Horizontal.TScrollbar {
230+
Horizontal.Scrollbar.trough -sticky news -children {
231+
Horizontal.Scrollbar.thumb -expand true
232+
}
233+
}
234+
235+
ttk::style configure Heading \
236+
-relief raised \
237+
;
238+
ttk::style map Heading \
239+
-bordercolor $buttonborder \
240+
-background $buttonsbg \
241+
;
242+
243+
ttk::style configure Treeview \
244+
-relief flat \
245+
-bordercolor $colors(fieldbg) \
246+
-lightcolor $colors(fieldbg) \
247+
-background $colors(fieldbg) \
248+
;
249+
ttk::style map Treeview \
250+
-background [list \
251+
selected $basecol \
252+
disabled $colors(darkcolor)] \
253+
-foreground [list \
254+
selected $colors(selectfg)] \
255+
;
256+
}
257+
}

tcl/themes/sand.tcl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Create a custom "sand" theme that inherits from classic and adjusts background
2+
if {[lsearch -exact [ttk::style theme names] sand] == -1} {
3+
ttk::style theme create sand -parent classic -settings {
4+
# Sand theme based on Chess_Manager_Web palette
5+
# Base/UI background and text
6+
ttk::style configure . \
7+
-background #D2B48C \
8+
-fieldbackground #F4E1C6 \
9+
-foreground #3B2F2F \
10+
-selectbackground #B08968 \
11+
-selectforeground #1E1A19
12+
ttk::style configure TFrame -background #D2B48C
13+
ttk::style configure TLabel -background #D2B48C -foreground #3B2F2F
14+
ttk::style configure TNotebook -background #D2B48C
15+
# Content windows (Tree view, Game List, PGN text via applyThemeStyle)
16+
ttk::style configure Treeview -background #F4E1C6 -fieldbackground #F4E1C6 -foreground #3B2F2F
17+
ttk::style map Treeview \
18+
-background [list selected #B08968] \
19+
-foreground [list selected #1E1A19]
20+
# Inputs
21+
ttk::style configure TEntry -fieldbackground #F4E1C6 -foreground #3B2F2F
22+
ttk::style configure TCombobox -fieldbackground #F4E1C6 -foreground #3B2F2F
23+
# Buttons
24+
ttk::style configure TButton -background #C19A6B -foreground #1E1A19 -borderwidth 1 -relief raised -padding {6 2}
25+
ttk::style map TButton -background [list active #CFB080 pressed #A67C52] -relief [list pressed sunken]
26+
# Menubuttons
27+
ttk::style configure TMenubutton -background #C19A6B -foreground #1E1A19 -borderwidth 1 -relief raised
28+
# Checkboxes and radiobuttons: explicit indicator colors for visibility
29+
ttk::style configure TCheckbutton -background #D2B48C -foreground #3B2F2F -indicatorcolor #F4E1C6
30+
ttk::style map TCheckbutton \
31+
-background [list active #D2B48C] \
32+
-indicatorcolor [list pressed #F4E1C6 selected #4a90d9 alternate #4a90d9]
33+
ttk::style configure TRadiobutton -background #D2B48C -foreground #3B2F2F -indicatorcolor #F4E1C6
34+
ttk::style map TRadiobutton \
35+
-background [list active #D2B48C] \
36+
-indicatorcolor [list pressed #F4E1C6 selected #4a90d9 alternate #4a90d9]
37+
}
38+
}

0 commit comments

Comments
 (0)