Debian Codegraph @

src/gtk4/widgets/_button.scss

raw
1 @charset "UTF-8";
2
3 // buttons
4
5 @mixin btn-highlight($c) {
6 $bg: gtk("@theme_button_background_normal");
7 $fg: gtk("@theme_button_foreground_normal");
8
9 background-color: gtkalpha($c, 0.2);
10 border-color: gtkmix($c, gtkmix($bg, $fg, 0.333), 0.5);
11 }
12
13 @mixin linked() {
14 border-right-style: none;
15 border-radius: 0;
16
17 &:first-child {
18 border-top-left-radius: $r;
19 border-bottom-left-radius: $r;
20 }
21 &:last-child {
22 border-right-style: solid;
23 border-top-right-radius: $r;
24 border-bottom-right-radius: $r;
25 }
26
27 &:only-child {
28 border-style: solid;
29 border-radius: $r;
30 }
31 }
32
33
34 @mixin linked-vertical() {
35 border-bottom-style: none;
36 border-radius: 0;
37
38 &:first-child {
39 border-top-left-radius: $r;
40 border-top-right-radius: $r;
41 }
42
43 &:last-child {
44 border-bottom-style: solid;
45 border-bottom-left-radius: $r;
46 border-bottom-right-radius: $r;
47 }
48
49 &:only-child {
50 border-style: solid;
51 }
52 }
53
54 @mixin linked-side() {
55 &:focus {
56 + entry {
57 border-left-color: gtk(
58 "@theme_view_active_decoration_color"
59 );
60 }
61 + button {
62 border-left-color: gtk(
63 "@theme_button_decoration_focus"
64 );
65 }
66 }
67 &:hover {
68 + entry {
69 border-left-color: gtk(
70 "@theme_view_active_decoration_color"
71 );
72 }
73 + button {
74 border-left-color: gtk(
75 "@theme_button_decoration_hover"
76 );
77 }
78 }
79 }
80
81 @mixin linked-side-vertical() {
82 &:focus {
83 + entry {
84 border-top-color: gtk("@theme_view_active_decoration_color");
85 }
86 + button {
87 border-top-color: gtk("@theme_view_active_decoration_color");
88 }
89 }
90 &:hover {
91 + entry {
92 border-top-color: gtk("@theme_view_active_decoration_color");
93 }
94 + button {
95 border-top-color: gtk("@theme_view_active_decoration_color");
96 }
97 }
98 }
99
100 // button styles mixin: $t is normal or toolbutton
101 @mixin neobutton($t) {
102 &.suggested-action {
103 @include btn-highlight(
104 gtk("@theme_button_decoration_focus")
105 );
106 }
107 &.destructive-action {
108 @include btn-highlight(gtk("@error_color"));
109 }
110
111 @if $t == normal {
112 box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.125);
113 text-shadow: none;
114 -gtk-icon-shadow: none;
115
116 color: gtk("@theme_button_foreground_normal");
117 border-color: gtk("@borders");
118 background: gtk("@theme_button_background_normal");
119
120 &:backdrop {
121 box-shadow: none;
122 background: gtk("@theme_button_background_normal");
123 }
124
125 &:checked {
126 background: gtkalpha(
127 gtk("@theme_button_foreground_normal"),
128 0.125
129 );
130 box-shadow: none;
131 }
132
133 &:hover {
134 border-color: gtk("@theme_button_decoration_hover");
135
136 &:not(:checked):not(:active) {
137 background: gtk("@theme_button_background_normal");
138 }
139 }
140
141 &:active {
142 box-shadow: none;
143 background: gtkalpha(
144 gtk("@theme_button_decoration_hover"),
145 0.333
146 );
147 }
148
149 &:focus {
150 border-color: gtk("@theme_button_decoration_focus");
151 }
152
153 &:disabled {
154 box-shadow: none;
155 color: gtk("@theme_button_foreground_insensitive");
156 border-color: gtk("@insensitive_borders");
157 background: gtk(
158 "@theme_button_background_insensitive"
159 );
160
161 &:active,
162 &:checked {
163 color: gtk(
164 "@theme_button_foreground_active_insensitive"
165 );
166 }
167 }
168 } @else if $t == toolbutton {
169 border-color: transparent;
170 background: transparent;
171 background-color: transparent;
172 background-image: none;
173 box-shadow: none;
174 color: gtk("@theme_button_foreground_normal");
175
176 text-shadow: none;
177 -gtk-icon-shadow: none;
178
179 &:checked {
180 border-color: gtkmix(
181 gtk("@theme_button_background_normal"),
182 gtk("@theme_button_foreground_normal"),
183 0.3
184 );
185 background-color: gtkalpha(
186 gtk("@theme_button_foreground_normal"),
187 0.125
188 );
189 }
190
191 &:hover {
192 border-color: gtk("@theme_button_decoration_hover");
193
194 &:not(:checked):not(:active) {
195 background: unset;
196 }
197 }
198
199 &:active {
200
201 border-color: gtk("@theme_button_decoration_hover");
202 background-color: gtkalpha(
203 gtk("@theme_button_decoration_hover"),
204 0.333
205 );
206 }
207
208
209 &:focus {
210 border-color: gtk("@theme_button_decoration_focus");
211 }
212 }
213 }
214
215 /***********
216 * Buttons *
217 ***********/
218
219 // stuff for .needs-attention
220 $_dot_color: gtk("@theme_button_decoration_focus");
221 @keyframes needs_attention {
222 from {
223 background-image: radial-gradient(
224 circle,
225 $_dot_color 0%,
226 transparent 5px
227 );
228 }
229 to {
230 background-image: radial-gradient(
231 circle,
232 gtk("@theme_selected_bg_color") 0%,
233 transparent 6px
234 );
235 }
236 }
237
238 %buttons {
239 border: 1px solid;
240 border-radius: $r;
241 padding: 6px 6px;
242 background-clip: border-box;
243
244 @include neobutton(normal);
245 &.flat {
246 @include neobutton(toolbutton);
247 }
248
249 separator {
250 background-color: transparent;
251 background-image: none;
252 color: transparent;
253 }
254 }
255 %button,
256 button {
257 @at-root %button_basic,
258 & {
259 @extend %buttons;
260 &.osd {
261 @extend %buttons;
262 }
263 //overlay / OSD style
264 .osd & {
265 //@extend %buttons;
266 }
267
268 &.image-button {
269 min-width: 16px;
270 min-height: 16px;
271 padding: 6px;
272 }
273
274 &.text-button {
275 padding-left: 6px;
276 padding-right: 6px;
277 }
278
279 &.circular {
280 min-width: 18px;
281 min-height: 18px;
282 border-radius: 9999px;
283 }
284
285 &.text-button.image-button {
286 padding-left: 6px;
287 padding-right: 6px;
288 label {
289 padding-left: 6px;
290 padding-right: 6px;
291 }
292 }
293 // FIXME
294 // &:drop(active) {
295 // color: $drop_target_color;
296 // border-color: $drop_target_color;
297 // box-shadow: inset 0 0 0 1px $drop_target_color;
298 // }
299 }
300
301 @at-root %button_selected,
302 & {
303 row:selected & {
304 border-color: gtk("@theme_selected_bg_color");
305
306 &.flat:not(:active):not(:checked):not(:hover):not(disabled) {
307 color: gtk("@theme_selected_fg_color");
308 border-color: transparent;
309
310 &:backdrop {
311 color: gtk("@theme_unfocused_selected_fg_color");
312 }
313 }
314 }
315 }
316
317 .stack-switcher > & {
318 // to position the needs attention dot, padding is added to the button
319 // child, a label needs just lateral padding while an icon needs vertical
320 // padding added too.
321 > label {
322 padding-left: 6px; // label padding
323 padding-right: 6px; //
324 }
325 > image {
326 padding-left: 6px; // image padding
327 padding-right: 6px; //
328 padding-top: 3px; //
329 padding-bottom: 3px; //
330 }
331 &.text-button {
332 padding: 6px; // needed or it will get overridden
333 }
334 &.image-button {
335 // we want image buttons to have a 1:1 aspect ratio, so compensation
336 // of the padding added to the GtkImage is needed
337 padding: 3px 0px;
338 }
339 &.needs-attention > label,
340 &.needs-attention > image {
341 @extend %needs_attention;
342 }
343 &.needs-attention:active > label,
344 &.needs-attention:active > image,
345 &.needs-attention:focus > label,
346 &.needs-attention:focus > image,
347 &.needs-attention:checked > label,
348 &.needs-attention:checked > image {
349 animation: none;
350 background-image: none;
351 }
352 }
353
354 //inline-toolbar buttons
355 .inline-toolbar &,
356 .inline-toolbar &:backdrop {
357 border-radius: $r;
358 border-width: 1px;
359 }
360
361 .primary-toolbar & {
362 -gtk-icon-shadow: none;
363 }
364 }
365
366 /**************
367 * ComboBoxes *
368 **************/
369 combobox,
370 dropdown {
371 arrow {
372 -gtk-icon-source: -gtk-icontheme($arrow_down);
373 min-height: 16px;
374 min-width: 16px;
375 }
376 }
377
378 combobox {
379 button {
380 padding-top: 4px;
381 padding-bottom: 4px;
382 }
383
384 > box > button.combo:only-child {
385 // remove a shadow for headerbar comboboxes
386 headerbar &,
387 .linked & {
388 box-shadow: none;
389 }
390
391 arrow {
392 min-width: 14px;
393
394 &:dir(rtl) {
395 margin-left: -3px;
396 }
397
398 &:dir(ltr) {
399 margin-right: -3px;
400 }
401 }
402 }
403 }
404
405 %needs_attention {
406 animation: needs_attention 150ms ease-in;
407 $_dot_shadow: gtk("@theme_button_foreground_normal");
408 $_dot_shadow_r: 0.5;
409 background-image: radial-gradient(
410 circle,
411 $_dot_color 0%,
412 transparent 5px
413 );
414 background-size: 6px 6px, 6px 6px;
415 background-repeat: no-repeat;
416 background-position: right 3px, right 4px;
417 &:backdrop {
418 background-size: 6px 6px, 0 0;
419 }
420 &:dir(rtl) {
421 background-position: left 3px, left 4px;
422 }
423 }
424
425 box.linked:not(.vertical),
426 box.inline-toolbar:not(.vertical),
427 buttonbox.linked:not(.vertical) {
428 &:not(.dialog-action-area) { // make an exception for dialog buttons to look more consistent in Qt environment
429 entry,
430 button:not(.toggle) {
431 // if we have a box-shadow, buttons look raised while the
432 // other elements aren't, which looks weird, and we can't really
433 // fix it, so just drop the box shadow in this case.
434 &:not(.combo) {
435 box-shadow: none;
436 }
437 @include linked();
438 @include linked-side();
439 }
440 }
441 }
442
443 box.linked.vertical,
444 box.inline-toolbar.vertical,
445 buttonbox.linked.vertical {
446 &:not(.dialog-action-area) {
447 entry,
448 button:not(.toggle) {
449 &:not(.combo) {
450 box-shadow: none;
451 }
452 @include linked-vertical();
453 @include linked-side-vertical();
454 }
455 }
456 }
457
458 stackswitcher.linked {
459 button:not(.flat) {
460 box-shadow: none;
461 @include linked();
462 @include linked-side();
463 }
464 }
465
466 %undecorated_button {
467 border-color: transparent;
468 background-color: transparent;
469 background-image: none;
470 box-shadow: none;
471 text-shadow: none;
472 -gtk-icon-shadow: none;
473 }