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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
|
// Drawing mixins
// generic drawing of more complex things
@function _widget_edge($c:$borders_edge) {
// outer highlight "used" on most widgets
@if $c == none { @return none; }
@else { @return 0 1px $c; }
}
@mixin _shadows($list...) {
//
// Helper mixin to stack up to box-shadows;
//
$shadows: null;
@each $shadow in $list {
@if $shadow!=none { $shadows: $shadows, $shadow; }
}
box-shadow: $shadows;
}
// entries // Yaru change: we detached focus from selection
@function entry_focus_border($fc:$focus_border_color) {
@if $variant == 'light' { @return $fc; }
@else { @return $focus_border_color }
}
@function entry_focus_shadow($fc:$focus_border_color) { @return inset 0 0 0 1px $fc; } // Yaru change: we detached focus from selection
@mixin entry($t, $fc:$focus_border_color, $edge: none) { // Yaru change: we detached focus from selection
//
// Entries drawing function
//
// $t: entry type
// $fc: focus color
// $edge: set to none to not draw the bottom edge or specify a color to not
// use the default one
//
// possible $t values:
// normal, focus, insensitive, backdrop, backdrop-insensitive, osd, osd-focus, osd-backdrop;
//
$_blank_edge: if($edge == none, none, 0 1px transparentize($edge, 1));
$_entry_edge: if($edge == none, none, _widget_edge($edge));
@if $t==normal {
color: $text_color;
border-color: $borders_color;
background-color: $base_color;
@include _shadows(entry_focus_shadow(transparentize($fc, 1)), $_entry_edge);
// for the transition to work the number of shadows in different states needs to match, hence the transparent shadow here.
}
@if $t==focus {
box-shadow: inset 0px 1px $button_default_box_shadow_color,
inset 1px 0px $button_default_box_shadow_color,
inset -1px 0px $button_default_box_shadow_color,
inset 0px -1px $button_default_box_shadow_color;
border-color: $button_default_border_color;
}
@if $t==insensitive {
color: $insensitive_fg_color;
border-color: $borders_color;
background-color: $insensitive_bg_color;
box-shadow: $_entry_edge;
}
@if $t==backdrop {
color: $backdrop_text_color;
border-color: $backdrop_borders_color;
background-color: $backdrop_base_color;
box-shadow: $_blank_edge;
}
@if $t==backdrop-insensitive {
color: $backdrop_insensitive_color;
border-color: $backdrop_borders_color;
background-color: $insensitive_bg_color;
box-shadow: $_blank_edge;
}
@if $t==osd {
color: $osd_text_color;
border-color: $osd_borders_color;
background-color: transparentize($fg_color, 0.5);
// background-color: transparentize(opacify($osd_borders_color, 1), 0.5);
background-clip: padding-box;
box-shadow: none;
text-shadow: 0 1px black;
-gtk-icon-shadow: 0 1px black;
}
@if $t==osd-focus {
color: $osd_text_color;
border-color: $selected_bg_color;
background-color: transparentize(opacify($osd_borders_color, 1), 0.5);
background-clip: padding-box;
box-shadow: entry_focus_shadow($fc);
text-shadow: 0 1px black;
-gtk-icon-shadow: 0 1px black;
}
@if $t==osd-insensitive {
color: $osd_insensitive_fg_color;
border-color: $osd_borders_color;
background-color: $osd_insensitive_bg_color;
background-clip: padding-box;
box-shadow: none;
text-shadow: none;
-gtk-icon-shadow: none;
}
@if $t==osd-backdrop {
color: $osd_text_color;
border-color: $osd_borders_color;
background-color: transparentize(opacify($osd_borders_color, 1), 0.5);
background-clip: padding-box;
box-shadow: none;
text-shadow: none;
-gtk-icon-shadow: none;
}
}
// buttons
@function _border_color($c, $darker: false) {
@if $darker == true { @return darken($c, 20%); }
@else { @return darken($c, 10%); }
}
@function _text_shadow_color ($tc: $fg_color, $bg: $bg_color) {
//
// calculate the color of text shadows
//
// $tc is the text color
// $bg is the background color
//
$_lbg: lightness($bg)/100%;
@if lightness($tc)<50% { @return transparentize(white, 1-$_lbg/($_lbg*1.3)); }
@else { @return transparentize(black, $_lbg*0.8); }
}
@function _button_hilight_color($c) {
//
// calculate the right top hilight color for buttons
//
// $c: base color;
//
@if lightness($c)>95% { @return white; }
@else if lightness($c)>90% { @return transparentize(white, 0.2); }
@else if lightness($c)>80% { @return transparentize(white, 0.5); }
@else if lightness($c)>50% { @return transparentize(white, 0.8); }
@else if lightness($c)>40% { @return transparentize(white, 0.9); }
@else { @return transparentize(white, 0.98); }
}
@mixin _button_text_shadow ($tc:$fg_color, $bg:$bg_color) {
//
// helper function for the text emboss effect
//
// $tc is the optional text color, not the shadow color
//
// TODO: this functions needs a way to deal with special cases
//
$_shadow: _text_shadow_color($tc, $bg);
@if lightness($tc)<50% {
text-shadow: 0 1px $_shadow;
-gtk-icon-shadow: 0 1px $_shadow;
}
@else {
text-shadow: 0 -1px $_shadow;
-gtk-icon-shadow: 0 -1px $_shadow;
}
}
@mixin button($t, $c:$bg_color, $tc:$fg_color, $edge: none) {
//
// Button drawing function
//
// $t: button type,
// $c: base button color for colored* types
// $tc: optional text color for colored* types
// $edge: set to none to not draw the bottom edge or specify a color to not
// use the default one
//
// possible $t values:
// normal, hover, active, insensitive, insensitive-active,
// backdrop, backdrop-active, backdrop-insensitive, backdrop-insensitive-active,
// osd, osd-hover, osd-active, osd-insensitive, osd-backdrop, undecorated
//
// This mixin sets the $button_fill global variable which containts the button background-image
//
$_hilight_color: _button_hilight_color($c);
$_button_edge: if($edge == none, none, _widget_edge($edge));
$_blank_edge: if($edge == none, none, _widget_edge(transparentize($edge,1)));
$_button_shadow: 0 1px 2px transparentize($shadow_color, 0.03);
@if $t==normal {
//
// normal button
//
color: $tc;
outline-color: $focus_border_color; // Yaru change: we detached focus from selection
border-color: if($c != $bg_color, _border_color($c), $borders_color);
// border-bottom-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
// Yaru change: we don't want to use gradients on buttons
background-image: linear-gradient(to bottom, $button_gradient_a,$button_gradient_b 50%, $button_gradient_c 50%, $button_gradient_d );
@include _button_text_shadow($tc, $c);
@include _shadows(0 1px transparentize(black, 0.95)); // Yaru change: stronger shadows for flatter buttons
}
@else if $t==hover {
//
// hovered button
//
color: $tc;
outline-color: $focus_border_color; // Yaru change: we detached focus from selection
border-color: if($c != $bg_color, _border_color($c), $borders_color);
border-bottom-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
@include _button_text_shadow($tc, lighten($c, 6%));
@include _shadows(inset 0 1px _button_hilight_color(lighten($c, 6%)), $_button_edge, $_button_shadow);
background-color: $selected_bg_color;
box-shadow: 0 1px transparentize(black, if($variant=='light', 0.85, 0.9)); // Yaru change: stronger shadows for flatter buttons
background-image: linear-gradient(to bottom,
$button_hover_gradient_a 5%,
$button_hover_gradient_b 95%,
$button_hover_gradient_c);
}
@if $t==normal-alt {
//
// normal button alternative look
//
color: $tc;
outline-color: $focus_border_color; // Yaru change: we detached focus from selection
border-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
@include _button_text_shadow($tc, $c);
@if $variant == 'light' {
background-image: linear-gradient(to bottom, lighten($c, 5%) 20%, $c 90%);
@include _shadows(inset 0 1px _button_hilight_color(lighten($c, 6%)),
$_button_edge, $_button_shadow);
}
@else {
background-image: linear-gradient(to bottom, darken($c, 3%) 20%, darken($c, 6%) 90%);
@include _shadows(inset 0 1px $_hilight_color,
$_button_edge, $_button_shadow);
}
@include _shadows(0 1px transparentize(black, 0.95)); // Yaru change: stronger shadows for flatter buttons
background-image: image(if($variant=='light', lighten($c, 10%), $warm_gray)); // Yaru change: brighter alt
background-clip: padding-box; // Yaru change: fix background overflow
}
@else if $t==hover-alt {
//
// hovered button alternative look
//
color: $tc;
outline-color: $focus_border_color; // Yaru change: we detached focus from selection
border-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
@if $variant == 'light' {
$button_fill: linear-gradient(to bottom, lighten($c, 9%) 10%, lighten($c, 4%) 90%) !global;
@include _shadows(inset 0 1px _button_hilight_color(lighten($c, 6%)),
$_button_edge, $_button_shadow);
}
@else {
$button_fill: linear-gradient(to bottom, $c 20%, darken($c, 4%) 90%) !global;
@include _shadows(inset 0 1px $_hilight_color,
$_button_edge, $_button_shadow);
}
background-image: image(if($variant=='light', lighten($c, 16%), lighten($warm_gray, 4%))); // Yaru change: brighter alt hover
box-shadow: 0 1px transparentize(black, 0.85); // Yaru change: stronger shadows for flatter buttons
}
@else if $t==active {
//
// pushed button
//
color: $tc;
outline-color: $focus_border_color; // Yaru change: we detached focus from selection
border-color: if($c != $bg_color, _border_color($c), $borders_color);
background-image: linear-gradient(to bottom,$button_active_gradient_a,
$button_active_gradient_b 3px,
$button_active_gradient_c 4px,
$button_active_gradient_d 50%,
$button_active_gradient_e 50%,
$button_active_gradient_f);
@include _shadows(inset 0 1px transparentize($_hilight_color, 1), $_button_edge);
text-shadow: none;
-gtk-icon-shadow: none;
}
@else if $t==insensitive {
//
// insensitive button
//
$_bg: if($c != $bg_color, mix($c, $base_color, 85%), $insensitive_bg_color);
color: if($tc != $fg_color, mix($tc, $_bg, 50%), $insensitive_fg_color);
border-color: if($c != $bg_color, _border_color($c), $insensitive_borders_color);
background-image: linear-gradient(to bottom, $button_insensitive_gradient_a,$button_insensitive_gradient_b 50%, $button_insensitive_gradient_c 50%, $button_insensitive_gradient_d );
text-shadow: none;
-gtk-icon-shadow: none;
// white with 0 alpha to avoid an ugly transition, since no color means
// black with 0 alpha
@include _shadows(inset 0 1px transparentize(white, 1), $_button_edge);
}
@else if $t==insensitive-active {
//
// insensitive pushed button
//
$_bg: if($variant == 'light', darken(mix($c, $base_color, 85%), 8%), darken(mix($c, $base_color, 85%), 6%));
$_bc: if($c != $bg_color, _border_color($c), $insensitive_borders_color);
color: if($c != $bg_color, mix($tc, $_bg, 60%), $insensitive_fg_color);
border-color: $_bc;
$button_fill: image($_bg) !global;
background-image: linear-gradient(to bottom,
$button_active_insensitive_gradient_a,
$button_active_insensitive_gradient_b 3px,
$button_active_insensitive_gradient_c 4px,
$button_active_insensitive_gradient_d 50%,
$button_active_insensitive_gradient_e 50%,
$button_active_insensitive_gradient_f);
// white with 0 alpha to avoid an ugly transition, since no color means
// black with 0 alpha
@include _shadows(inset 0 1px transparentize(white, 1), $_button_edge);
}
@else if $t==backdrop {
//
// backdrop button
//
$_bg: if($c != $bg_color, $c, $backdrop_bg_color);
$_bc: if($variant == 'light', $c, _border_color($c));
color: if($tc != $fg_color, mix($tc, $_bg, 80%), $backdrop_fg_color);
border-color: if($c != $bg_color, $_bc, $backdrop_borders_color);
//see at normal
background-image: linear-gradient(to bottom, $button_gradient_a,$button_gradient_b 50%, $button_gradient_c 50%, $button_gradient_d );
text-shadow: none;
-gtk-icon-shadow: none;
@include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge);
}
@else if $t==backdrop-active {
//
// backdrop pushed button
//
$_bg: if($variant == 'light', darken(mix($c, $base_color, 85%), 8%), darken(mix($c, $base_color, 85%), 4%));
$_bc: if($variant == 'light', $_bg ,_border_color($c));
color: if($tc != $fg_color, mix($tc, $_bg, 80%), $backdrop_fg_color);
border-color: if($c != $bg_color, $_bc, $backdrop_borders_color);
$button_fill: image($_bg) !global;
background-image: $button_fill;
@include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge);
}
@else if $t==backdrop-insensitive {
//
// backdrop insensitive button
//
$_bg: if($c != $bg_color, mix($c, $base_color, 85%), if($variant=='light', $insensitive_bg_color, lighten($insensitive_bg_color, 3%))); // Yaru change
$_bc: if($variant == 'light', $_bg,_border_color($c));
color: if($c != $bg_color, mix($tc, $_bg, 35%), $backdrop_insensitive_color);
border-color: if($c != $bg_color, $_bc, $backdrop_borders_color);
background-image: linear-gradient(to bottom, $button_insensitive_gradient_a,$button_insensitive_gradient_b 50%, $button_insensitive_gradient_c 50%, $button_insensitive_gradient_d );
text-shadow: none;
-gtk-icon-shadow: none;
// white with 0 alpha to avoid an ugly transition, since no color means
// black with 0 alpha
@include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge);
}
@else if $t==backdrop-insensitive-active {
//
// backdrop insensitive pushed button
//
$_bg: if($variant == 'light', darken(mix($c, $base_color, 85%), 8%), darken(mix($c, $base_color, 85%), 4%));
$_bc: if($variant == 'light', $_bg, _border_color($c));
color: if($c != $bg_color, mix($tc, $_bg, 35%), $backdrop_insensitive_color);
border-color: if($c != $bg_color, $_bc, $backdrop_borders_color);
$button_fill: image($_bg) !global;
background-image: $button_fill;
@include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge);
}
@else if $t==osd {
//
// normal osd button
//
$_bg: if($c != $bg_color, transparentize($c, 0.5), lighten($osd_bg_color, 9%)); // Yaru change: make osd buttons visible
color: $osd_fg_color;
border-color: $osd_borders_color;
background-color: transparent;
$button_fill: image($_bg) !global;
background-image: $button_fill;
background-clip: padding-box;
// box-shadow: inset 0 1px transparentize(white, 0.9); // Yaru change: remove the shadow
text-shadow: 0 1px black;
-gtk-icon-shadow: 0 1px black;
outline-color: transparentize($osd_fg_color, 0.7);
}
@else if $t==osd-hover {
//
// active osd button
//
$_bg: if($c != $bg_color, transparentize($c, 0.3), lighten($osd_bg_color, 12%));
color: white;
border-color: $osd_borders_color;
background-color: transparent;
$button_fill: image($_bg) !global;
background-image: $button_fill;
background-clip: padding-box;
// box-shadow: inset 0 1px transparentize(white, 0.9); // Yaru change: remove the shadow
text-shadow: 0 1px black;
-gtk-icon-shadow: 0 1px black;
outline-color: transparentize($osd_fg_color, 0.7);
}
@else if $t==osd-active {
//
// active osd button
//
$_bg: if($c != $bg_color, $c, $osd_borders_color);
color: white;
border-color: $osd_borders_color;
background-color: transparent;
$button_fill: image($_bg) !global;
background-image: $button_fill;
background-clip: padding-box;
box-shadow: none;
text-shadow: none;
-gtk-icon-shadow: none;
outline-color: transparentize($osd_fg_color, 0.7);
}
@else if $t==osd-insensitive {
//
// insensitive osd button
//
color: $osd_insensitive_fg_color;
border-color: $osd_borders_color;
background-color: transparent;
$button_fill: image($osd_insensitive_bg_color) !global;
background-image: $button_fill;
background-clip: padding-box;
box-shadow: none;
text-shadow: none;
-gtk-icon-shadow: none;
}
@else if $t==osd-backdrop {
//
// backdrop osd button
//
$_bg: if($c != $bg_color, transparentize($c, 0.5), $osd_bg_color);
color: $osd_fg_color;
border-color: $osd_borders_color;
background-color: transparent;
$button_fill: image($_bg) !global;
background-image: $button_fill;
background-clip: padding-box;
box-shadow: none;
text-shadow: none;
-gtk-icon-shadow: none;
}
@else if $t==undecorated {
//
// reset
//
border-color: transparent;
background-color: transparent;
$button_fill: none !global;
background-image: $button_fill;
@include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge);
text-shadow: none;
-gtk-icon-shadow: none;
}
}
@mixin headerbar_fill($c:$headerbar_color, $hc:$top_hilight, $ov: none) {
//
// headerbar fill
//
// $c: base color
// $hc: top highlight color
// $ov: a background layer for background shorthand (hence no commas!)
//
background-image: linear-gradient(to bottom,
gtkshade($selected_bg_color, 1.08) ,
gtkshade($selected_bg_color, 1.02) 50%,
gtkshade($selected_bg_color, 1.0) 50%,
gtkshade($selected_bg_color, 0.94));
&:backdrop{
background-image: linear-gradient(to bottom,
gtkshade($bg_color, 0.99) ,
gtkshade($bg_color, 0.95) 50%,
gtkshade($bg_color, 0.93)50%,
gtkshade($bg_color, 0.89));
}
}
@mixin overshoot($p, $t:normal, $c:$fg_color) {
//
// overshoot
//
// $p: position
// $t: type
// $c: base color
//
// possible $p values:
// top, bottom, right, left
//
// possible $t values:
// normal, backdrop
//
$_small_gradient_length: 5%;
$_big_gradient_length: 100%;
$_position: center top;
$_small_gradient_size: 100% $_small_gradient_length;
$_big_gradient_size: 100% $_big_gradient_length;
@if $p==bottom {
$_position: center bottom;
$_linear_gradient_direction: to top;
}
@else if $p==right {
$_position: right center;
$_small_gradient_size: $_small_gradient_length 100%;
$_big_gradient_size: $_big_gradient_length 100%;
}
@else if $p==left {
$_position: left center;
$_small_gradient_size: $_small_gradient_length 100%;
$_big_gradient_size: $_big_gradient_length 100%;
}
$_small_gradient_color: $c;
$_big_gradient_color: $c;
@if $c==$fg_color {
$_small_gradient_color: darken($borders_color, 10%);
$_big_gradient_color: $fg_color;
@if $t==backdrop { $_small_gradient_color: $backdrop_borders_color; }
}
$_small_gradient: -gtk-gradient(radial,
$_position, 0,
$_position, 0.5,
to($_small_gradient_color),
to(transparentize($_small_gradient_color, 1)));
$_big_gradient: -gtk-gradient(radial,
$_position, 0,
$_position, 0.6,
from(transparentize($_big_gradient_color, 0.93)),
to(transparentize($_big_gradient_color, 1)));
@if $t==normal {
background-image: $_small_gradient, $_big_gradient;
background-size: $_small_gradient_size, $_big_gradient_size;
}
@else if $t==backdrop {
background-image: $_small_gradient;
background-size: $_small_gradient_size;
}
background-repeat: no-repeat;
background-position: $_position;
background-color: transparent; // reset some properties to be sure to not inherit them somehow
border: none; //
box-shadow: none; //
}
/***************************
* Check and Radio buttons *
***************************/
@mixin check($t, $c:$bg_color, $tc:$fg_color, $checked: false) {
// Check/Radio drawing function
//
// $t: check/radio type,
// $c: base button color for colored* types
// $tc: optional text color for colored* types
// $checked: bool to chose between checked/unchecked
//
// possible $t values:
// normal, hover, active, insensitive, backdrop, backdrop-insensitive
$_border_color: if($c==$checkradio_bg_color, $c, $alt_borders_color);
$_dim_border_color: transparentize($_border_color, if($variant == 'light', 0.3, 0.7));
@if $t==normal { // Yaru change: no gradients, better borders
background-clip: if($checked, border-box, padding-box);
background-image: image(white);
border-color: $_border_color;
box-shadow: 0 1px transparentize(black, 0.95);
color: $fg_color;
}
@if $t==hover {
background-image: image($core_color_a);
border-color: darken($core_color_a , 20%);
}
@if $t==active {
border-color: $borders_color;
background-image: image(white);
box-shadow: none;
color: $fg_color;
}
@if $t==insensitive {
box-shadow: none;
color: $insensitive_fg_color;
border-color: $insensitive_borders_color;
background-image: image($insensitive_bg_color);
}
@if $t==backdrop {
background-image: image(white);
border-color: $_border_color;
box-shadow: 0 1px transparentize(black, 0.95);
color: $fg_color;
}
@if $t==backdrop-insensitive {
box-shadow: none;
color: $backdrop_fg_color;
border-color: $insensitive_borders_color;
background-image: image($insensitive_bg_color);
}
}
|