3
// generic drawing of more complex things
5
@function _widget_edge($c: $borders_edge) {
6
// outer highlight "used" on most widgets
15
@mixin _shadows($list...) {
17
// Helper mixin to stack up to box-shadows;
21
@each $shadow in $list {
23
$shadows: $shadows, $shadow;
31
@function entry_focus_border($fc: $selected_bg_color) {
35
@function entry_focus_shadow($fc: $selected_bg_color) {
36
@return inset 0 0 0 1px $fc;
39
@mixin entry($t, $fc: $selected_bg_color, $edge: none) {
41
// Entries drawing function
45
// $edge: set to none to not draw the bottom edge or specify a color to not
46
// use the default one
48
// possible $t values:
49
// normal, focus, insensitive, backdrop, backdrop-insensitive, osd, osd-focus, osd-backdrop;
52
$_blank_edge: if($edge == none, none, 0 1px transparentize($edge, 1));
53
$_entry_edge: if($edge == none, none, _widget_edge($edge));
56
color: $base_normal_fg_color;
57
border-color: $base_normal_border_color;
58
background-color: $base_normal_bg_color;
60
// for the transition to work the number of shadows in different states needs to match, hence the transparent shadow here.
64
border-color: $base_focused_border_color;
67
@if $t == insensitive {
68
color: $base_insensitive_fg_color;
69
border-color: $base_insensitive_border_color;
70
background-color: $base_insensitive_bg_color;
71
box-shadow: $_entry_edge;
75
color: $backdrop_text_color;
76
border-color: $backdrop_borders_color;
77
background-color: $backdrop_base_color;
78
box-shadow: $_blank_edge;
81
@if $t == backdrop-insensitive {
82
color: $backdrop_insensitive_color;
83
border-color: $backdrop_borders_color;
84
background-color: $insensitive_bg_color;
85
box-shadow: $_blank_edge;
89
color: $osd_text_color;
90
border-color: $osd_borders_color;
91
background-color: transparentize(opacify($osd_borders_color, 1), 0.5);
92
background-clip: padding-box;
94
text-shadow: 0 1px black;
95
-gtk-icon-shadow: 0 1px black;
99
color: $osd_text_color;
100
border-color: $selected_bg_color;
101
background-color: transparentize(opacify($osd_borders_color, 1), 0.5);
102
background-clip: padding-box;
103
box-shadow: entry_focus_shadow($fc);
104
text-shadow: 0 1px black;
105
-gtk-icon-shadow: 0 1px black;
108
@if $t == osd-insensitive {
109
color: $osd_insensitive_fg_color;
110
border-color: $osd_borders_color;
111
background-color: $osd_insensitive_bg_color;
112
background-clip: padding-box;
115
-gtk-icon-shadow: none;
118
@if $t == osd-backdrop {
119
color: $osd_text_color;
120
border-color: $osd_borders_color;
121
background-color: transparentize(opacify($osd_borders_color, 1), 0.5);
122
background-clip: padding-box;
125
-gtk-icon-shadow: none;
131
@function _border_color($c, $darker: false) {
132
@if $darker == true {
133
@return darken($c, 30%);
136
@return darken($c, 20%);
140
@function _text_shadow_color($tc: $fg_color, $bg: $bg_color) {
142
// calculate the color of text shadows
144
// $tc is the text color
145
// $bg is the background color
147
$_lbg: lightness($bg) / 100%;
149
@if lightness($tc) < 50% {
150
@return transparentize(white, 1 - $_lbg / ($_lbg * 1.3));
153
@return transparentize(black, $_lbg * 0.8);
157
@function _button_hilight_color($c) {
159
// calculate the right top hilight color for buttons
163
@if lightness($c) > 95% {
166
@else if lightness($c) > 90% {
167
@return transparentize(white, 0.2);
169
@else if lightness($c) > 80% {
170
@return transparentize(white, 0.4);
172
@else if lightness($c) > 50% {
173
@return transparentize(white, 0.6);
175
@else if lightness($c) > 40% {
176
@return transparentize(white, 0.8);
179
@return transparentize(white, 0.95);
183
@mixin _button_text_shadow($tc: $fg_color, $bg: $bg_color) {
185
// helper function for the text emboss effect
187
// $tc is the optional text color, not the shadow color
189
// TODO: this functions needs a way to deal with special cases
192
$_shadow: _text_shadow_color($tc, $bg);
194
@if lightness($tc) < 50% {
195
text-shadow: 0 1px $_shadow;
196
-gtk-icon-shadow: 0 1px $_shadow;
199
text-shadow: 0 -1px $_shadow;
200
-gtk-icon-shadow: 0 -1px $_shadow;
204
@mixin button($t, $c: $bg_color, $tc: $fg_color, $edge: none) {
206
// Button drawing function
209
// $c: base button color for colored* types
210
// $tc: optional text color for colored* types
211
// $edge: set to none to not draw the bottom edge or specify a color to not
212
// use the default one
214
// possible $t values:
215
// normal, hover, active, insensitive, insensitive-active,
216
// backdrop, backdrop-active, backdrop-insensitive, backdrop-insensitive-active,
217
// osd, osd-hover, osd-active, osd-insensitive, osd-backdrop, undecorated
219
// This mixin sets the $button_fill global variable which containts the button background-image
221
$_hilight_color: _button_hilight_color($c);
222
$_button_edge: if($edge == none, none, _widget_edge($edge));
223
$_blank_edge: if($edge == none, none, _widget_edge(transparentize($edge, 1)));
230
outline-color: transparentize($tc, 0.7);
231
border-color: $base_normal_border_color;
233
$button_fill: linear-gradient(to bottom, $c, darken($c, 4%) 60%, darken($c, 10%)) !global;
235
background-image: $button_fill;
237
@include _button_text_shadow($tc, $c);
239
@else if $t == hover {
244
outline-color: transparentize($tc, 0.7);
245
border-color: $base_prelight_border_color;
247
$button_fill: linear-gradient(to bottom, lighten($c, 6%), $c 60%, darken($c, 4%)) !global;
249
@include _button_text_shadow($tc, lighten($c, 6%));
251
background-image: $button_fill;
254
@if $t == normal-alt {
256
// normal button alternative look
259
outline-color: transparentize($tc, 0.7);
260
border-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
262
@include _button_text_shadow($tc, $c);
264
background-image: linear-gradient(to bottom, lighten($c, 5%) 20%, $c 90%);
266
@else if $t == hover-alt {
268
// hovered button alternative look
271
outline-color: transparentize($tc, 0.7);
272
border-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
274
$button_fill: linear-gradient(to bottom, lighten($c, 9%) 10%, lighten($c, 4%) 90%) !global;
276
background-image: $button_fill;
278
@else if $t == active {
283
outline-color: transparentize($tc, 0.7);
284
border-color: $base_active_border_color;
286
$button_fill: image(darken($c, 6%)) !global;
288
background-image: $button_fill;
290
-gtk-icon-shadow: none;
292
@else if $t == insensitive {
294
// insensitive button
296
$_bg: if($c != $bg_color, mix($c, $base_color, 85%), $insensitive_bg_color);
299
color: if($tc != $fg_color, mix($tc, $_bg, 50%), $insensitive_fg_color);
302
border-color: $base_insensitive_border_color;
304
$button_fill: image($_bg) !global;
306
background-image: $button_fill;
308
-gtk-icon-shadow: none;
310
// white with 0 alpha to avoid an ugly transition, since no color means
311
// black with 0 alpha
313
@else if $t == insensitive-active {
315
// insensitive pushed button
317
$_bg: darken(mix($c, $base_color, 85%), 8%);
318
$_bc: if($c != $bg_color, _border_color($c), $insensitive_borders_color);
321
color: if($c != $bg_color, mix($tc, $_bg, 60%), $insensitive_fg_color);
326
$button_fill: image($_bg) !global;
328
background-image: $button_fill;
330
// white with 0 alpha to avoid an ugly transition, since no color means
331
// black with 0 alpha
333
@else if $t == backdrop {
337
$_bg: if($c != $bg_color, $c, $backdrop_bg_color);
341
color: if($tc != $fg_color, mix($tc, $_bg, 80%), $backdrop_fg_color);
344
border-color: $base_backdrop_border_color;
346
$button_fill: image($_bg) !global;
348
background-image: $button_fill;
350
-gtk-icon-shadow: none;
352
@else if $t == backdrop-active {
354
// backdrop pushed button
356
$_bg: darken(mix($c, $base_color, 85%), 8%);
360
color: if($tc != $fg_color, mix($tc, $_bg, 80%), $backdrop_fg_color);
363
border-color: if($c != $bg_color, $_bc, $backdrop_borders_color);
365
$button_fill: image($_bg) !global;
367
background-image: $button_fill;
369
@else if $t == backdrop-insensitive {
371
// backdrop insensitive button
374
$_bg: if($c != $bg_color, mix($c, $base_color, 85%), $insensitive_bg_color);
378
color: if($c != $bg_color, mix($tc, $_bg, 35%), $backdrop_insensitive_color);
381
border-color: if($c != $bg_color, $_bc, $backdrop_borders_color);
383
$button_fill: image($_bg) !global;
385
background-image: $button_fill;
387
-gtk-icon-shadow: none;
389
// white with 0 alpha to avoid an ugly transition, since no color means
390
// black with 0 alpha
392
@else if $t == backdrop-insensitive-active {
394
// backdrop insensitive pushed button
397
$_bg: darken(mix($c, $base_color, 85%), 8%);
401
color: if($c != $bg_color, mix($tc, $_bg, 35%), $backdrop_insensitive_color);
404
border-color: if($c != $bg_color, $_bc, $backdrop_borders_color);
406
$button_fill: image($_bg) !global;
408
background-image: $button_fill;
414
$_bg: if($c != $bg_color, transparentize($c, 0.5), $osd_bg_color);
416
color: $osd_fg_color;
417
border-color: $osd_borders_color;
418
background-color: transparent;
420
$button_fill: image($_bg) !global;
422
background-image: $button_fill;
423
background-clip: padding-box;
424
box-shadow: inset 0 1px transparentize(white, 0.9);
425
text-shadow: 0 1px black;
426
-gtk-icon-shadow: 0 1px black;
427
outline-color: transparentize($osd_fg_color, 0.7);
429
@else if $t == osd-hover {
433
$_bg: if($c != $bg_color, transparentize($c, 0.3), lighten($osd_bg_color, 12%));
436
border-color: $osd_borders_color;
437
background-color: transparent;
439
$button_fill: image($_bg) !global;
441
background-image: $button_fill;
442
background-clip: padding-box;
443
box-shadow: inset 0 1px transparentize(white, 0.9);
444
text-shadow: 0 1px black;
445
-gtk-icon-shadow: 0 1px black;
446
outline-color: transparentize($osd_fg_color, 0.7);
448
@else if $t == osd-active {
452
$_bg: if($c != $bg_color, $c, $osd_borders_color);
455
border-color: $osd_borders_color;
456
background-color: transparent;
458
$button_fill: image($_bg) !global;
460
background-image: $button_fill;
461
background-clip: padding-box;
464
-gtk-icon-shadow: none;
465
outline-color: transparentize($osd_fg_color, 0.7);
467
@else if $t == osd-insensitive {
469
// insensitive osd button
471
color: $osd_insensitive_fg_color;
472
border-color: $osd_borders_color;
473
background-color: transparent;
475
$button_fill: image($osd_insensitive_bg_color) !global;
477
background-image: $button_fill;
478
background-clip: padding-box;
481
-gtk-icon-shadow: none;
483
@else if $t == osd-backdrop {
485
// backdrop osd button
487
$_bg: if($c != $bg_color, transparentize($c, 0.5), $osd_bg_color);
489
color: $osd_fg_color;
490
border-color: $osd_borders_color;
491
background-color: transparent;
493
$button_fill: image($_bg) !global;
495
background-image: $button_fill;
496
background-clip: padding-box;
499
-gtk-icon-shadow: none;
501
@else if $t == undecorated {
505
border-color: transparent;
506
background-color: transparent;
508
$button_fill: none !global;
510
background-image: $button_fill;
512
-gtk-icon-shadow: none;
516
@mixin headerbar_fill($c: $headerbar_color, $hc: $top_hilight, $ov: none) {
521
// $hc: top highlight color
522
// $ov: a background layer for background shorthand (hence no commas!)
524
$gradient: linear-gradient(to top, darken($c, 13%), darken($c, 2%) 2px, $c 3px);
527
background: $c $ov, $gradient;
530
background: $c $gradient;
538
@mixin overshoot($p, $t: normal, $c: $fg_color) {
546
// possible $p values:
547
// top, bottom, right, left
549
// possible $t values:
553
$_small_gradient_length: 5%;
554
$_big_gradient_length: 100%;
556
$_position: center top;
557
$_small_gradient_size: 100% $_small_gradient_length;
558
$_big_gradient_size: 100% $_big_gradient_length;
561
$_position: center bottom;
562
$_linear_gradient_direction: to top;
564
@else if $p == right {
565
$_position: right center;
566
$_small_gradient_size: $_small_gradient_length 100%;
567
$_big_gradient_size: $_big_gradient_length 100%;
569
@else if $p == left {
570
$_position: left center;
571
$_small_gradient_size: $_small_gradient_length 100%;
572
$_big_gradient_size: $_big_gradient_length 100%;
575
$_small_gradient_color: $c;
576
$_big_gradient_color: $c;
578
@if $c == $fg_color {
579
$_small_gradient_color: darken($borders_color, 10%);
580
$_big_gradient_color: $fg_color;
583
$_small_gradient_color: $backdrop_borders_color;
587
$_small_gradient: -gtk-gradient(radial, $_position, 0, $_position, 0.5, to($_small_gradient_color), to(transparentize($_small_gradient_color, 1)));
589
$_big_gradient: -gtk-gradient(radial, $_position, 0, $_position, 0.6, from(transparentize($_big_gradient_color, 0.93)), to(transparentize($_big_gradient_color, 1)));
592
background-image: $_small_gradient, $_big_gradient;
593
background-size: $_small_gradient_size, $_big_gradient_size;
595
@else if $t == backdrop {
596
background-image: $_small_gradient;
597
background-size: $_small_gradient_size;
600
background-repeat: no-repeat;
601
background-position: $_position;
602
background-color: transparent;
604
// reset some properties to be sure to not inherit them somehow
613
@mixin undershoot($p) {
619
// possible $p values:
620
// top, bottom, right, left
623
$_undershoot_color_dark: transparentize(black, 0.8);
624
$_undershoot_color_light: transparentize(white, 0.8);
626
$_gradient_dir: left;
627
$_dash_bg_size: 10px 1px;
628
$_gradient_repeat: repeat-x;
631
background-color: transparent;
633
// shouldn't be needed, but better to be sure;
635
@if $p == left or $p == right {
637
$_dash_bg_size: 1px 10px;
638
$_gradient_repeat: repeat-y;
642
background-image: linear-gradient(to $_gradient_dir, $_undershoot_color_light 50%, $_undershoot_color_dark 50%);
644
background-size: $_dash_bg_size;
645
background-repeat: $_gradient_repeat;
646
background-origin: content-box;
647
background-position: $_bg_pos;
b'\\ No newline at end of file'