_drawing-3.20.scss
ASCII text
1
// generic drawing of more complex things
2
3
//
4
// Ripple keyframes
5
//
6
7
@keyframes ripple {
8
to {
9
background-size: 1000% 1000%;
10
}
11
}
12
13
@keyframes ripple-on-slider {
14
to {
15
background-size: auto, 1000% 1000%;
16
}
17
}
18
19
@keyframes ripple-on-headerbar {
20
from {
21
background-image: radial-gradient(circle, $primary 0%, transparent 0%);
22
}
23
24
to {
25
background-image: radial-gradient(circle, $primary 100%, transparent 0%);
26
}
27
}
28
29
30
@mixin entry($t, $fc: $primary) {
31
//
32
// entry
33
//
34
// $t: entry type
35
// $fc: focus color
36
//
37
38
@if $t == normal {
39
transition: $transition, border-image $ripple-fade-in-duration $ease-out;
40
border-image:
41
radial-gradient(
42
circle closest-corner at center calc(100% - 1px),
43
$fc 0%,
44
transparent 0%
45
) 2 / 0 0 0;
46
box-shadow: inset 0 0 0 9999px transparent, inset 0 -1px if($fc == $primary, $stroke, $fc);
47
background-color: $entry-fill;
48
color: $text;
49
caret-color: $fc;
50
}
51
52
@if $t == hover {
53
box-shadow: inset 0 0 0 9999px $overlay-hover, inset 0 -1px if($fc == $primary, $stroke, $fc);
54
}
55
56
@if $t == focus {
57
box-shadow: inset 0 0 0 9999px $overlay-focus, inset 0 -1px if($fc == $primary, $stroke, $fc);
58
}
59
60
@if $t == checked {
61
border-image:
62
radial-gradient(
63
circle closest-corner at center calc(100% - 1px),
64
$fc 100%,
65
transparent 0%
66
) 2 / 0 0 2px;
67
}
68
69
@if $t == disabled {
70
box-shadow: inset 0 0 0 9999px transparent, inset 0 -1px $stroke-disabled;
71
background-color: $entry-fill;
72
color: $text-disabled;
73
}
74
75
@if $t == raised-normal {
76
transition: $transition;
77
border-image: none;
78
box-shadow: $shadow-z1;
79
background-color: if($fc == $primary, $surface, $fc);
80
color: if($fc == $primary, $text, on($fc));
81
caret-color: if($fc == $primary, $fc, on($fc));
82
}
83
84
@if $t == raised-hover {
85
box-shadow: $shadow-z3;
86
}
87
88
@if $t == raised-focus {
89
border-image: none;
90
box-shadow: $shadow-z3;
91
}
92
93
@if $t == raised-disabled {
94
box-shadow: $shadow-z1;
95
background-color: $base-alt;
96
color: $text-disabled;
97
}
98
}
99
100
101
$ripple-transition-property: all, border-image, background-size, background-image;
102
$ripple-transition-duration: $duration, $ripple-fade-in-duration, $ripple-fade-out-duration, $ripple-fade-out-opacity-duration;
103
$ripple-active-transition-duration: $duration, $ripple-fade-in-duration, 0ms, 0ms;
104
105
%ripple {
106
transition-property: $ripple-transition-property;
107
transition-duration: $ripple-transition-duration;
108
transition-timing-function: $ease-out;
109
outline: none;
110
background-image: radial-gradient(circle, transparent 10%, transparent 0%);
111
background-repeat: no-repeat;
112
background-position: center;
113
background-size: 1000% 1000%;
114
115
&:active {
116
transition-duration: $ripple-active-transition-duration;
117
animation: ripple $ripple-fade-in-duration $ease-out forwards;
118
background-size: 0% 0%;
119
}
120
}
121
122
@mixin raised-ink-color($color, $opacity-modifier: 0) {
123
@if saturation($color) > 50% {
124
$opacity-modifier: .04;
125
}
126
127
$overlay-hover-opacity: .04;
128
129
box-shadow: inset 0 0 0 9999px transparent, $shadow-z2;
130
131
&:drop(active),
132
&:hover {
133
box-shadow: inset 0 0 0 9999px rgba($color, $overlay-hover-opacity + $opacity-modifier), $shadow-z4;
134
}
135
136
&:focus {
137
box-shadow: inset 0 0 0 9999px rgba($color, $overlay-focus-opacity + $opacity-modifier), $shadow-z4;
138
}
139
140
&:active {
141
box-shadow: inset 0 0 0 9999px rgba($color, $overlay-focus-opacity + $opacity-modifier), $shadow-z8;
142
background-image: radial-gradient(circle, rgba($color, $overlay-active-opacity + $opacity-modifier) 10%, transparent 0%);
143
}
144
}
145
146
@mixin ink-color($color, $opacity-modifier: 0, $fg: true, $activated: false) {
147
@if saturation($color) > 50% {
148
$opacity-modifier: .04;
149
}
150
151
@if $fg {
152
color: $color;
153
}
154
155
@if $activated {
156
background-color: rgba($color, $overlay-checked-opacity + $opacity-modifier);
157
}
158
159
box-shadow: inset 0 0 0 9999px transparent;
160
161
&:drop(active),
162
&:hover {
163
box-shadow: inset 0 0 0 9999px rgba($color, $overlay-hover-opacity + $opacity-modifier);
164
}
165
166
&:focus {
167
box-shadow: inset 0 0 0 9999px rgba($color, $overlay-focus-opacity + $opacity-modifier);
168
}
169
170
&:active {
171
background-image: radial-gradient(circle, rgba($color, $overlay-active-opacity + $opacity-modifier) 10%, transparent 0%);
172
}
173
}
174
175
@mixin list-item {
176
&:drop(active):not(:active),
177
&:hover:not(:active) {
178
transition-property: $ripple-transition-property, box-shadow;
179
transition-duration: $ripple-transition-duration, 0ms;
180
}
181
}
182
183
184
@mixin overshoot($side) {
185
$valid-sides: top, bottom, left, right;
186
187
@if not index($valid-sides, $side) {
188
@error "#{$side} is not a valid side. Expected one of #{$valid-sides}.";
189
}
190
191
$_position: center $side;
192
193
@if $side == left or $side == right {
194
$_position: $side center;
195
}
196
197
background-image:
198
-gtk-gradient(
199
radial,
200
$_position, 0,
201
$_position, .75,
202
to(rgba($primary, .24)),
203
to(transparent)
204
);
205
206
background-repeat: no-repeat;
207
background-position: $_position;
208
209
background-color: transparent; // reset some properties to be sure to not inherit them somehow
210
border: none; //
211
box-shadow: none; //
212
}
213
214
215
@mixin undershoot($side) {
216
$valid-sides: top, bottom, left, right;
217
218
@if not index($valid-sides, $side) {
219
@error "#{$side} is not a valid side. Expected one of #{$valid-sides}.";
220
}
221
222
$_undershoot_color_dark: $stroke;
223
$_undershoot_color_light: transparent;
224
225
$_gradient_dir: left;
226
$_dash_bg_size: 12px 1px;
227
$_gradient_repeat: repeat-x;
228
$_bg_pos: left $side;
229
230
@if $side == left or $side == right {
231
$_gradient_dir: top;
232
$_dash_bg_size: 1px 12px;
233
$_gradient_repeat: repeat-y;
234
$_bg_pos: $side top;
235
}
236
237
background-color: transparent; // shouldn't be needed, but better to be sure
238
239
background-image: linear-gradient(to $_gradient_dir, // this is the dashed line
240
$_undershoot_color_light 50%,
241
$_undershoot_color_dark 50%);
242
243
padding-#{$side}: 1px;
244
background-size: $_dash_bg_size;
245
background-repeat: $_gradient_repeat;
246
background-origin: content-box;
247
background-position: $_bg_pos;
248
}
249