Skip to content

Commit fcebd44

Browse files
committed
Rework Helium shadow system
1 parent 56dcd4c commit fcebd44

File tree

3 files changed

+62
-33
lines changed

3 files changed

+62
-33
lines changed

Helium/gtk-3.0/_functions.scss

+41
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,45 @@
3030
} @else {
3131
@return (calc($pixels / $text-size) * 1rem) - 0.000000001rem;
3232
}
33+
}
34+
35+
@function shadow($level) {
36+
// Sunken controls
37+
@if $level == -1 {
38+
@return
39+
0 -2px 0 0 rgb(0, 0, 0, 0.1),
40+
0 -1px 2px 0 rgb(0, 0, 0, 0.05),
41+
0 1px 2px 0 rgb(255, 255, 255, 0.05),
42+
0 2px 0 0 rgb(255, 255, 255, 0.1);
43+
// Outline border
44+
} @else if $level == 0 {
45+
@return
46+
0 1px 2px 0px rgb(0, 0, 0, 0.14),
47+
0 1px 2px 0px rgb(0, 0, 0, 0.14);
48+
// Elevation 1
49+
} @else if $level == 1 {
50+
@return
51+
0 2px 4px 0px rgb(0, 0, 0, 0.14),
52+
0 2px 4px 0px rgb(0, 0, 0, 0.14);
53+
// Elevation 2
54+
} @else if $level == 2 {
55+
@return
56+
0 4px 8px 0px rgb(0, 0, 0, 0.14),
57+
0 4px 8px 0px rgb(0, 0, 0, 0.14);
58+
// Elevation 3
59+
} @else if $level == 3 {
60+
@return
61+
0 8px 16px 0px rgb(0, 0, 0, 0.14),
62+
0 8px 16px 0px rgb(0, 0, 0, 0.14);
63+
// Elevation 4
64+
} @else if $level == 4 {
65+
@return
66+
0 0 8px 0px rgb(0, 0, 0, 0.20),
67+
0 14px 28px 0px rgb(0, 0, 0, 0.24);
68+
// Elevation 5
69+
} @else if $level == 5 {
70+
@return
71+
0 0 8px 0px rgb(0, 0, 0, 0.20),
72+
0 32px 64px 0px rgb(0, 0, 0, 0.24);
73+
}
3374
}

Helium/gtk-3.0/widgets/_headerbar.scss

+9-15
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,8 @@ window.devel {
351351
decoration {
352352
border-radius: $window_radius $window_radius 0 0;
353353
border-width: 0px;
354-
355-
// this needs to be transparent
356-
// see bug #722563
357-
$_wm_border: if($variant=='light', transparentize(black, 0.9), gtkshade($borders_color, 0.88));
358-
$_wm_border_backdrop: if($variant=='light', transparentize(black, 0.9), gtkshade($borders_color, 0.88));
359-
360-
box-shadow: 0 3px 9px 1px transparentize(black, 0.5),
361-
0 0 0 1px $_wm_border; //doing borders with box-shadow
354+
box-shadow: shadow(5),
355+
0 0 0 1px gtkalpha($border_color, 0.4); //doing borders with box-shadow
362356

363357
// this is used for the resize cursor area
364358
margin: 10px;
@@ -368,9 +362,9 @@ decoration {
368362
// change when we go to backdrop, to prevent jumping windows.
369363
// The biggest shadow should be in the same order than in the active state
370364
// or the jumping will happen during the transition.
371-
box-shadow: 0 3px 9px 1px transparent,
372-
0 2px 6px 2px transparentize(black, 0.8),
373-
0 0 0 1px $_wm_border_backdrop;
365+
box-shadow: 0 14px 28px 0 transparent,
366+
shadow(4),
367+
0 0 0 1px gtkalpha($border_color, 0.12);
374368
}
375369

376370
.maximized &,
@@ -382,11 +376,11 @@ decoration {
382376
.tiled-bottom &,
383377
.tiled-left & {
384378
border-radius: 0;
385-
box-shadow: 0 0 0 1px $_wm_border,
386-
0 0 0 20px transparent; //transparent control workaround -- #3670
379+
box-shadow: 0 0 0 1px gtkalpha($border_color, 0.4),
380+
0 0 0 20px transparent;
387381

388-
&:backdrop { box-shadow: inset 1px 0 $_wm_border_backdrop,
389-
0 0 0 20px transparent; // #3670
382+
&:backdrop { box-shadow: inset 1px 0 gtkalpha($border_color, 0.12),
383+
0 0 0 20px transparent;
390384
}
391385
}
392386

Helium/gtk-4.0/_functions.scss

+12-18
Original file line numberDiff line numberDiff line change
@@ -76,39 +76,33 @@
7676
// Outline border
7777
} @else if $level == 0 {
7878
@return
79-
0 0 0 0 rgb(0, 0, 0, 0.2),
80-
0 0 0 0 rgb(0, 0, 0, 0.14),
81-
0 0 0 0 rgb(0, 0, 0, 0.12);
79+
0 1px 2px 0px rgb(0, 0, 0, 0.14),
80+
0 1px 2px 0px rgb(0, 0, 0, 0.14);
8281
// Elevation 1
8382
} @else if $level == 1 {
8483
@return
85-
0 3px 1px -2px rgb(0, 0, 0, 0.2),
86-
0 2px 2px 0 rgb(0, 0, 0, 0.14),
87-
0 1px 5px 0 rgb(0, 0, 0, 0.12);
84+
0 2px 4px 0px rgb(0, 0, 0, 0.14),
85+
0 2px 4px 0px rgb(0, 0, 0, 0.14);
8886
// Elevation 2
8987
} @else if $level == 2 {
9088
@return
91-
0 2px 4px -1px rgb(0, 0, 0, 0.2),
92-
0 4px 5px 0 rgb(0, 0, 0, 0.14),
93-
0 1px 10px 0 rgb(0, 0, 0, 0.12);
89+
0 4px 8px 0px rgb(0, 0, 0, 0.14),
90+
0 4px 8px 0px rgb(0, 0, 0, 0.14);
9491
// Elevation 3
9592
} @else if $level == 3 {
9693
@return
97-
0 5px 5px -3px rgb(0, 0, 0, 0.2),
98-
0 8px 10px 1px rgb(0, 0, 0, 0.14),
99-
0 3px 14px 2px rgb(0, 0, 0, 0.12);
94+
0 8px 16px 0px rgb(0, 0, 0, 0.14),
95+
0 8px 16px 0px rgb(0, 0, 0, 0.14);
10096
// Elevation 4
10197
} @else if $level == 4 {
10298
@return
103-
0 5px 5px -3px rgb(0, 0, 0, 0.2),
104-
0 8px 10px 1px rgb(0, 0, 0, 0.14),
105-
0 3px 14px 2px rgb(0, 0, 0, 0.12);
99+
0 0 8px 0px rgb(0, 0, 0, 0.20),
100+
0 14px 28px 0px rgb(0, 0, 0, 0.24);
106101
// Elevation 5
107102
} @else if $level == 5 {
108103
@return
109-
0 8px 10px -6px rgb(0, 0, 0, 0.2),
110-
0 16px 24px 2px rgb(0, 0, 0, 0.14),
111-
0 6px 30px 5px rgb(0, 0, 0, 0.12);
104+
0 0 8px 0px rgb(0, 0, 0, 0.20),
105+
0 32px 64px 0px rgb(0, 0, 0, 0.24);
112106
}
113107
}
114108

0 commit comments

Comments
 (0)