File: darktheme.tcl

package info (click to toggle)
scid 1%3A4.7.4%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,340 kB
  • sloc: tcl: 92,411; cpp: 38,013; sh: 1,697; python: 277; javascript: 201; makefile: 89; perl: 86
file content (248 lines) | stat: -rw-r--r-- 8,510 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#
# Copyright (C) 2020 Uwe Klimmek
#
# This file is part of Scid (Shane's Chess Information Database).
# Scid is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation.

### Implements a "dark" theme.

namespace eval ttk::theme::dark {
    array set colors {
        background     "#323232"
        foreground     "#e0e0e0"
        disabledfg     "#a0a0a0"
        buttonbg       "#3b3b3e"
        buttonbgdark   "#2b2b2e"
        buttonbglight  "#4b4b4e"
        labelframe     "#a5a6a9"
        fieldbg        "#1e1e1e"
        fieldborder    "#292929"
        darkcolor      "#222222"
        lightcolor     "#656669"
        notebookborder "#555659"
        selectbg       "#555659"
        selectfg       "#ffffff"
        through        "#353639"
    }

    ttk::style theme create dark -parent clam -settings {
        set basecol DodgerBlue3 ;# Alternative: #3b6dce Basecolor, change here to have new topic for the theme
        # -----------------------------------------------------------------------------
        # Theme defaults
        ttk::style configure "." \
            -foreground $colors(foreground) \
            -background $colors(background) \
            -darkcolor $colors(darkcolor) \
            -lightcolor $colors(lightcolor) \
            -troughcolor $colors(through) \
            -selectbackground $basecol \
            -selectforeground $colors(selectfg) \
            -activebackground $basecol \
            -activeforeground $colors(selectfg) \
            -indicatorbackground $colors(fieldbg) \
            -indicatorforeground $colors(foreground) \
            -fieldbackground $colors(fieldbg) \
            -bordercolor $colors(fieldborder) \
            -selectborderwidth 0 \
            -arrowcolor $colors(foreground) \
            -insertcolor $colors(foreground) \
            -insertbackground $colors(foreground) \
            -selectcolor $colors(foreground) \
        ;

        ttk::style map "." \
            -foreground [list \
                disabled $colors(disabledfg)] \
            -background [list \
                active $colors(buttonbglight)] \
            -fieldbackground [list \
                disabled $colors(background)] \
            -indicatorbackground [list \
                pressed $colors(background) \
                alternate $colors(disabledfg) \
                disabled $colors(background)] \
            -indicatorforeground [list \
                disabled $colors(disabledfg)] \
            -arrowcolor [list \
                disabled $colors(disabledfg)] \
        ;

        set borders [list disabled $colors(fieldborder) {active pressed} $basecol \
                    {disabled selected} $colors(fieldborder) {pressed selected} $basecol pressed $basecol \
                    {active selected} $basecol active $basecol selected $basecol focus $basecol ]
        set buttonborder [list disabled $colors(fieldborder) {active pressed} $basecol \
                    {disabled selected} $colors(fieldborder) {pressed selected} $basecol pressed $basecol \
                    {active selected} $basecol active $basecol selected $basecol ]
        set buttonsbg [list disabled $colors(through) pressed $colors(buttonbgdark) \
                    active $colors(buttonbglight) ]

        ttk::style configure TButton \
            -anchor center \
            -relief raised \
            -padding 4 \
            -background $colors(buttonbg) \
        ;
        ttk::style map TButton \
            -bordercolor $buttonborder \
            -background $buttonsbg \
        ;

        ttk::style configure TMenubutton \
            -anchor center \
            -padding 4 \
            -relief raised \
            -background $colors(buttonbg) \
        ;
        ttk::style map TMenubutton \
            -bordercolor $borders \
            -background $buttonsbg \
        ;

        ttk::style configure Toolbutton \
            -anchor center \
            -padding 2 \
            -relief flat \
        ;
        ttk::style map Toolbutton \
            -relief [list \
                selected raised \
                active raised] \
            -bordercolor $borders \
            -foreground [list \
                disabled $colors(disabledfg)] \
            -background [list \
                pressed $basecol \
                active $colors(darkcolor)] \
            -lightcolor [list pressed $basecol] \
            -darkcolor [list pressed $basecol] \
        ;

        ttk::style configure TCheckbutton \
            -padding 2
        ;
        ttk::style configure TRadiobutton \
            -padding 2
        ;

        ttk::style configure TCombobox \
            -anchor center \
            -padding 1 \
            -insertwidth 1 \
            -relief raised \
            -borderwidth 1 \
        ;
        ttk::style map TCombobox \
            -bordercolor $borders \
            -background $buttonsbg \
            -lightcolor $borders \
        ;
        if {[info procs ::styleOption] ne ""} {
            ::styleOption dark *TCombobox*Listbox.highlightThickness 1
            ::styleOption dark *TCombobox*Listbox.borderWidth 4
            ::styleOption dark *TCombobox*Listbox.background $colors(fieldbg)
            ::styleOption dark *TCombobox*Listbox.foreground $colors(foreground)
            ::styleOption dark *TCombobox*Listbox.selectBackground $basecol
            ::styleOption dark *TCombobox*Listbox.selectForeground $colors(selectfg)
        }

        ttk::style configure TEntry \
            -foreground $colors(selectfg) \
            -padding 1 \
            -insertwidth 1 \
        ;
        ttk::style map TEntry \
            -bordercolor $borders \
            -lightcolor $borders \
        ;

        ttk::style configure TSpinbox \
            -arrowsize 12 \
            -padding {2 0 10 0} \
        ;
        ttk::style map TSpinbox \
            -bordercolor $borders \
            -background $buttonsbg \
            -arrowcolor [list \
                disabled $colors(disabledfg)] \
        ;

        ttk::style configure TScale \
            -troughcolor $colors(through) \
        ;
        ttk::style map TScale \
            -bordercolor [list \
                active $basecol] \
        ;

        ttk::style configure TNotebook.Tab \
            -padding {6 2 6 2} \
        ;
        ttk::style map TNotebook.Tab \
            -padding [list \
                selected {6 4 6 2}] \
            -background [list \
                selected $colors(background) \
                {} $colors(fieldbg)] \
            -lightcolor [list \
                selected $colors(lightcolor) \
                {} $colors(notebookborder)] \
        ;

        ttk::style configure TPanedwindow \
            -sashrelief raised \
        ;

        ttk::style configure TLabelframe \
            -bordercolor $colors(labelframe) \
            -relief raised \
            -padding 4 \
        ;

        ttk::style configure TProgressbar \
            -background $basecol \
        ;

        ttk::style configure TScrollbar \
            -troughcolor $colors(fieldbg) \
            -bordercolor $colors(buttonbg) \
            -background $colors(through) \
            -arrowcolor $colors(lightcolor) \
        ;
        ttk::style map TScrollbar \
            -background [list \
                pressed $colors(buttonbglight) \
                active $colors(buttonbglight) \
                disabled $colors(through) \
                !pressed $colors(buttonbg)] \
            -lightcolor [list \
                pressed $colors(darkcolor) \
                active $colors(lightcolor) \
                disabled $colors(through)] \
            -darkcolor [list \
                pressed $colors(lightcolor) \
                active $colors(darkcolor) \
                disabled $colors(through)] \
        ;

        ttk::style configure Heading \
            -relief raised \
        ;
        ttk::style map Heading \
            -bordercolor $buttonborder \
            -background $buttonsbg \
        ;

        ttk::style configure Treeview \
            -background $colors(fieldbg) \
        ;
        ttk::style map Treeview \
            -background [list \
                selected $basecol \
                disabled $colors(darkcolor)] \
            -foreground [list \
                selected $colors(selectfg)] \
        ;
    }
}