Debian Codegraph @

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