-
Notifications
You must be signed in to change notification settings - Fork 6
/
breeze.tcl
337 lines (286 loc) · 13.7 KB
/
breeze.tcl
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# breeze.tcl --
#
# Breeze pixmap theme for the ttk package.
#
# Copyright (c) 2018 Maximilian Lika
package require Tk 8.6.0
namespace eval ttk::theme::Breeze {
variable version 0.8
package provide ttk::theme::Breeze $version
variable colors
array set colors {
-fg "#31363b"
-bg "#eff0f1"
#-disabledbg "#e3e5e6"
#-disabledfg "#a8a9aa"
-disabledfg "#bbcbbe"
-disabledbg "#e7e8ea"
-selectbg "#3daee9"
-selectfg "white"
-window "#eff0f1"
-focuscolor "#3daee9"
-checklight "#94d0eb"
}
proc LoadImages {imgdir} {
variable I
foreach file [glob -directory $imgdir *.png] {
set img [file tail [file rootname $file]]
set I($img) [image create photo -file $file -format png]
}
}
LoadImages [file join [file dirname [info script]] Breeze]
ttk::style theme create Breeze -parent default -settings {
ttk::style configure . \
-background $colors(-bg) \
-foreground $colors(-fg) \
-troughcolor $colors(-bg) \
-selectbackground $colors(-selectbg) \
-selectforeground $colors(-selectfg) \
-fieldbackground $colors(-window) \
-font "Helvetica 10" \
-borderwidth 1 \
-focuscolor $colors(-focuscolor) \
-highlightcolor $colors(-checklight)
ttk::style map . -foreground [list disabled $colors(-disabledfg)]
#
# Layouts:
#
ttk::style layout TButton {
Button.button -children {
Button.padding -children {
Button.label -side left -expand true
}
}
}
ttk::style layout Toolbutton {
Toolbutton.button -children {
Toolbutton.padding -children {
Toolbutton.label -side left -expand true
}
}
}
ttk::style layout Vertical.TScrollbar {
Vertical.Scrollbar.trough -sticky ns -children {
Vertical.Scrollbar.thumb -expand true
}
}
ttk::style layout Horizontal.TScrollbar {
Horizontal.Scrollbar.trough -sticky ew -children {
Horizontal.Scrollbar.thumb -expand true
}
}
ttk::style layout TMenubutton {
Menubutton.button -children {
Menubutton.focus -children {
Menubutton.padding -children {
Menubutton.indicator -side right
Menubutton.label -side right -expand true
}
}
}
}
ttk::style layout Item {
Treeitem.padding -sticky nswe -children {
Treeitem.indicator -side left -sticky {} Treeitem.image -side left -sticky {} -children {
Treeitem.text -side left -sticky {}
}
}
}
#
# Elements:
#
ttk::style element create Button.button image [list $I(button) \
pressed $I(button-focus) \
{active focus} $I(button-active) \
active $I(button-hover) \
focus $I(button-hover) \
disabled $I(button-insensitive) \
] -border 3 -sticky ewns
ttk::style element create Toolbutton.button image [list $I(empty) \
{active selected !disabled} $I(button-active) \
selected $I(button-toggled) \
pressed $I(button-active) \
{active !disabled} $I(button-hover) \
] -border 3 -sticky news
ttk::style element create Checkbutton.indicator image [list $I(checkbox-unchecked) \
disabled $I(checkbox-unchecked-insensitive) \
{pressed selected} $I(checkbox-checked-pressed) \
{active selected} $I(checkbox-checked-active) \
{pressed !selected} $I(checkbox-unchecked-pressed) \
active $I(checkbox-unchecked-active) \
selected $I(checkbox-checked) \
{disabled selected} $I(checkbox-checked-insensitive) \
] -width 22 -sticky w
ttk::style element create Radiobutton.indicator image [list $I(radio-unchecked) \
disabled $I(radio-unchecked-insensitive) \
{pressed selected} $I(radio-checked-pressed) \
{active selected} $I(radio-checked-active) \
{pressed !selected} $I(radio-unchecked-pressed) \
active $I(radio-unchecked-active) \
selected $I(radio-checked) \
{disabled selected} $I(radio-checked-insensitive) \
] -width 22 -sticky w
ttk::style element create Horizontal.Scrollbar.trough image $I(scrollbar-trough-horiz-active) \
-border {6 0 6 0} -sticky ew
ttk::style element create Horizontal.Scrollbar.thumb \
image [list $I(scrollbar-slider-horiz) \
{active !disabled} $I(scrollbar-slider-horiz-active) \
disabled $I(scrollbar-slider-insens) \
] -border {6 0 6 0} -sticky ew
ttk::style element create Vertical.Scrollbar.trough image $I(scrollbar-trough-vert-active) \
-border {0 6 0 6} -sticky ns
ttk::style element create Vertical.Scrollbar.thumb \
image [list $I(scrollbar-slider-vert) \
{active !disabled} $I(scrollbar-slider-vert-active) \
disabled $I(scrollbar-slider-insens) \
] -border {0 6 0 6} -sticky ns
ttk::style element create Horizontal.Scale.trough \
image [list $I(scrollbar-slider-horiz) disabled $I(scale-trough-horizontal)] \
-border {8 5 8 5} -padding 0
ttk::style element create Horizontal.Scale.slider \
image [list $I(scale-slider) \
disabled $I(scale-slider-insensitive) \
pressed $I(scale-slider-pressed)\
active $I(scale-slider-active) \
] \
-sticky {}
ttk::style element create Vertical.Scale.trough \
image [list $I(scrollbar-slider-vert) disabled $I(scale-trough-vertical)] \
-border {8 5 8 5} -padding 0
ttk::style element create Vertical.Scale.slider \
image [list $I(scale-slider) \
disabled $I(scale-slider-insensitive) \
pressed $I(scale-slider-pressed)\
active $I(scale-slider-active) \
] \
-sticky {}
ttk::style element create Entry.field \
image [list $I(entry) \
{focus !disabled} $I(entry-focus) \
{hover !disabled} $I(entry-active) \
disabled $I(entry-insensitive)] \
-border 3 -padding {6 8} -sticky news
ttk::style element create Labelframe.border image $I(labelframe) \
-border 4 -padding 4 -sticky news
ttk::style element create Menubutton.button \
image [list $I(button) \
pressed $I(button-active) \
active $I(button-hover) \
disabled $I(button-insensitive) \
] -sticky news -border 3 -padding {3 2}
ttk::style element create Menubutton.indicator \
image [list $I(arrow-down) \
active $I(arrow-down-prelight) \
pressed $I(arrow-down-prelight) \
disabled $I(arrow-down-insens) \
] -sticky e -width 20
ttk::style element create Combobox.field \
image [list $I(entry) \
{readonly disabled} $I(button-insensitive) \
{readonly pressed} $I(button-hover) \
{readonly focus hover} $I(button-active) \
{readonly focus} $I(button-focus) \
{readonly hover} $I(button-hover) \
readonly $I(button) \
{disabled} $I(entry-insensitive) \
{focus} $I(entry-focus) \
{focus hover} $I(entry-focus) \
{hover} $I(entry-active) \
] -border 4 -padding {6 8}
ttk::style element create Combobox.downarrow \
image [list $I(arrow-down) \
active $I(arrow-down-prelight) \
pressed $I(arrow-down-prelight) \
disabled $I(arrow-down-insens) \
] -border 4 -sticky {}
ttk::style element create Spinbox.field \
image [list $I(entry) focus $I(entry-focus) disabled $I(entry-insensitive) hover $I(entry-active)] \
-border 4 -padding {6 8} -sticky news
ttk::style element create Spinbox.uparrow \
image [list $I(arrow-up-small) \
active $I(arrow-up-small-prelight) \
pressed $I(arrow-up-small-prelight) \
disabled $I(arrow-up-small-insens) \
] -border 4 -sticky {}
ttk::style element create Spinbox.downarrow \
image [list $I(arrow-down-small) \
active $I(arrow-down-small-prelight) \
pressed $I(arrow-down-small-prelight) \
disabled $I(arrow-down-small-insens) \
] -border 4 -sticky {}
ttk::style element create Notebook.client \
image $I(notebook-client) -border 1
ttk::style element create Notebook.tab \
image [list $I(notebook-tab-top) \
selected $I(notebook-tab-top-active) \
active $I(notebook-tab-top-hover) \
] -padding {12 4 12 4} -border 2
# TODO Enhance
ttk::style element create Horizontal.Progressbar.trough \
image $I(scrollbar-trough-horiz-active) -border {6 0 6 0} -sticky ew
ttk::style element create Horizontal.Progressbar.pbar \
image $I(scrollbar-slider-horiz) -border {6 0 6 0} -sticky ew
ttk::style element create Vertical.Progressbar.trough \
image $I(scrollbar-trough-vert-active) -border {0 6 0 6} -sticky ns
ttk::style element create Vertical.Progressbar.pbar \
image $I(scrollbar-slider-vert) -border {0 6 0 6} -sticky ns
# TODO: Ab hier noch teilweise Arc style
ttk::style element create Treeview.field \
image $I(treeview) -border 1
ttk::style element create Treeheading.cell \
image [list $I(notebook-client) \
active $I(treeheading-prelight)] \
-border 1 -padding 4 -sticky ewns
# TODO: arrow-* ist at the moment a little bit too big
# the small version is too small :-)
# And at the moment there are no lines as in the Breeze theme
# And hover, pressed doesn't work
ttk::style element create Treeitem.indicator \
image [list $I(arrow-right) \
user2 $I(empty) \
user1 $I(arrow-down) \
] \
-width 15 -sticky w
# I don't know why Only with this I get a thin enough sash
ttk::style element create vsash image $I(transparent) -sticky e -padding 1 -width 1
ttk::style element create hsash image $I(transparent) -sticky n -padding 1 -width 1
#ttk::style element create Separator.separator image $I()
#
# Settings:
#
ttk::style configure TButton -padding {8 4 8 4} -width -10 -anchor center
ttk::style configure TMenubutton -padding {8 4 4 4}
ttk::style configure Toolbutton -padding {6 2} -anchor center
ttk::style configure TCheckbutton -padding 4
ttk::style configure TRadiobutton -padding 4
ttk::style configure TSeparator -background $colors(-bg)
#ttk::style configure TPanedwindow -width 1 -padding 0
ttk::style map TPanedwindow -background [list hover $colors(-checklight)]
ttk::style map TCombobox -selectbackground [list \
!focus $colors(-window) \
{readonly hover} $colors(-checklight) \
{readonly focus} $colors(-focuscolor) \
]
ttk::style map TCombobox -selectforeground [list \
!focus $colors(-fg) \
{readonly hover} $colors(-fg) \
{readonly focus} $colors(-selectfg) \
]
# Treeview
ttk::style configure Treeview -background white
ttk::style configure Treeview.Item -padding {2 0 0 0}
ttk::style map Treeview \
-background [list selected $colors(-selectbg)] \
-foreground [list selected $colors(-selectfg)]
# Some defaults for non ttk-widgets so that they fit
# to the Breeze theme, too
tk_setPalette background [ttk::style lookup . -background] \
foreground [ttk::style lookup . -foreground] \
highlightColor [ttk::style lookup . -focuscolor] \
selectBackground [ttk::style lookup . -selectbackground] \
selectForeground [ttk::style lookup . -selectforeground] \
activeBackground [ttk::style lookup . -selectbackground] \
activeForeground [ttk::style lookup . -selectforeground]
option add *font [ttk::style lookup . -font]
}
}