A fork of the Materia GTK theme.

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 _drawing.scss

View raw Download
text/plain • 10.24 kiB
ASCII text
        
            
1
// Drawing mixins
2
3
// generic drawing of more complex things
4
5
// shadows
6
7
// FIXME: doesn't work 1.5px
8
// $z-depth-1: 0 1px 1.5px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.24);
9
$z-depth-1: 0 1px 1px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
10
$z-depth-2: 0 3px 3px rgba(0, 0, 0, 0.16), 0 3px 3px rgba(0, 0, 0, 0.23);
11
$z-depth-3: 0 10px 10px rgba(0, 0, 0, 0.19), 0 6px 3px rgba(0, 0, 0, 0.23);
12
$z-depth-4: 0 14px 14px rgba(0, 0, 0, 0.25), 0 10px 5px rgba(0, 0, 0, 0.22);
13
$z-depth-5: 0 19px 19px rgba(0, 0, 0, 0.30), 0 15px 6px rgba(0, 0, 0, 0.22);
14
15
@keyframes ripple_effect {
16
from {
17
background-image: -gtk-gradient(radial,
18
center center, 0,
19
center center, 0.001,
20
to(gtkalpha(currentColor, $lower_opacity / 2)),
21
to(transparent)),
22
linear-gradient(to bottom, gtkalpha(currentColor, 0));
23
}
24
to {
25
background-image: -gtk-gradient(radial,
26
center center, 0,
27
center center, 0.4,
28
to(gtkalpha(currentColor, $lower_opacity / 2)),
29
to(transparent)),
30
linear-gradient(to bottom, gtkalpha(currentColor, $lower_opacity / 2));
31
}
32
}
33
34
@keyframes flat_ripple_effect {
35
from {
36
background-image: -gtk-gradient(radial,
37
center center, 0,
38
center center, 0.001,
39
to(gtkalpha(currentColor, $lower_opacity / 2)),
40
to(transparent)),
41
linear-gradient(to bottom, gtkalpha(currentColor, $lower_opacity / 2));
42
}
43
to {
44
background-image: -gtk-gradient(radial,
45
center center, 0,
46
center center, 0.4,
47
to(gtkalpha(currentColor, $lower_opacity / 2)),
48
to(transparent)),
49
linear-gradient(to bottom, gtkalpha(currentColor, $lower_opacity / 2));
50
}
51
}
52
53
@keyframes list_ripple_effect {
54
from {
55
background-image: -gtk-gradient(radial,
56
center center, 0,
57
center center, 0.001,
58
to(gtkalpha(currentColor, 0)),
59
to(transparent)),
60
linear-gradient(to bottom, gtkalpha(currentColor, 0.05));
61
}
62
to {
63
background-image: -gtk-gradient(radial,
64
center center, 0,
65
center center, 0.4,
66
to(gtkalpha(currentColor, $lower_opacity / 2)),
67
to(transparent)),
68
linear-gradient(to bottom, gtkalpha(currentColor, $lower_opacity / 2));
69
}
70
}
71
72
// entries
73
74
@mixin entry($t, $fc:$selected_bg_color) {
75
//
76
// Entries drawing function
77
//
78
// $t: entry type
79
// $fc: focus color
80
//
81
// possible $t values:
82
// normal, focus, insensitive, flat-normal, flat-focus, flat-insensitive;
83
//
84
85
@if $t==normal {
86
box-shadow: $z-depth-1;
87
background-color: if($fc!=$selected_bg_color, $fc, $base_color);
88
color: if($fc!=$selected_bg_color, $selected_fg_color, $fg_color);
89
}
90
@if $t==focus {
91
box-shadow: $z-depth-2;
92
}
93
@if $t==insensitive {
94
color: $insensitive_fg_color;
95
background-color: $secondary_base_color;
96
}
97
@if $t==flat-normal {
98
border-image: -gtk-gradient(radial,
99
center bottom, 0,
100
center bottom, 0.001,
101
to($fc),
102
to(transparent))
103
0 0 0 / 0 0 0px;
104
border-radius: 0;
105
box-shadow: inset 0 -1px if($fc!=$selected_bg_color, $fc, $track_color);
106
background-color: transparent;
107
color: $fg_color;
108
}
109
@if $t==flat-focus {
110
border-image: -gtk-gradient(radial,
111
center bottom, 0,
112
center bottom, 0.5,
113
to($fc),
114
to(transparent))
115
0 0 2 / 0 0 2px;
116
box-shadow: inset 0 -2px $fc;
117
transition: all $material_duration $material_timing_function, box-shadow 0 $material_timing_function $material_duration, color 0;
118
}
119
@if $t==flat-insensitive {
120
box-shadow: inset 0 -1px $track_color;
121
background-color: transparent;
122
color: $insensitive_fg_color;
123
}
124
}
125
126
// buttons
127
128
@mixin button($t, $c:$light_color, $tc:$fg_color) {
129
//
130
// Button drawing function
131
//
132
// $t: button type,
133
// $c: base button color for colored* types
134
// $tc: optional text color for colored* types
135
//
136
// possible $t values:
137
// normal, hover, active, insensitive, checked, checked-insensitive,
138
// flat-normal, flat-hover, flat-active, flat-insensitive, flat-checked, flat-checked-insensitive;
139
//
140
141
@if $t==normal {
142
//
143
// normal button
144
//
145
box-shadow: $z-depth-1;
146
background-color: $c;
147
background-image: -gtk-gradient(radial,
148
center center, 0,
149
center center, 0.5,
150
to(gtkalpha(currentColor, 0)),
151
to(transparent)),
152
linear-gradient(to bottom, gtkalpha(currentColor, 0));
153
color: $secondary_fg_color;
154
}
155
156
@else if $t==hover {
157
//
158
// hovered button
159
//
160
box-shadow: $z-depth-2;
161
background-image: -gtk-gradient(radial,
162
center center, 0,
163
center center, 0.5,
164
to(gtkalpha(currentColor, 0)),
165
to(transparent)),
166
linear-gradient(to bottom, gtkalpha(currentColor, 0));
167
color: $fg_color;
168
}
169
170
@else if $t==active {
171
//
172
// pushed button
173
//
174
box-shadow: $z-depth-2;
175
color: $fg_color;
176
transition-property: opacity, border-color, border-image, box-shadow,
177
background-color, text-shadow, icon-shadow; // Remove background-image
178
animation: ripple_effect $material_duration $material_timing_function forwards;
179
}
180
@else if $t==insensitive {
181
//
182
// insensitive button
183
//
184
box-shadow: none;
185
background-color: $track_color;
186
color: if($tc!=$fg_color, $insensitive_fg_color, $insensitive_secondary_fg_color);
187
> .label { color: inherit; }
188
}
189
@else if $t==checked {
190
//
191
// checked button
192
//
193
background-color: $selected_bg_color;
194
color: $selected_fg_color;
195
}
196
@else if $t==checked-insensitive {
197
//
198
// checked insensitive button
199
//
200
background-color: $track_color;
201
color: scale-alpha($selected_bg_color, $disabled_opacity);
202
> .label { color: inherit; }
203
}
204
205
@else if $t==flat-normal {
206
//
207
// normal flat button
208
//
209
box-shadow: none;
210
background-color: transparent;
211
background-image: -gtk-gradient(radial,
212
center center, 0,
213
center center, 0.5,
214
to(gtkalpha(currentColor, 0)),
215
to(transparent)),
216
linear-gradient(to bottom, gtkalpha(currentColor, 0));
217
}
218
@else if $t==flat-hover {
219
//
220
// hovered flat button
221
//
222
box-shadow: none;
223
background-image: -gtk-gradient(radial,
224
center center, 0,
225
center center, 0.5,
226
to(gtkalpha(currentColor, 0)),
227
to(transparent)),
228
linear-gradient(to bottom, gtkalpha(currentColor, $lower_opacity / 2));
229
}
230
@else if $t==flat-active {
231
//
232
// pushed flat button
233
//
234
box-shadow: none;
235
transition-property: opacity, border-color, border-image, box-shadow,
236
background-color, text-shadow, icon-shadow; // Remove background-image
237
animation: flat_ripple_effect $material_duration $material_timing_function forwards;
238
}
239
@else if $t==flat-insensitive {
240
//
241
// insensitive flat button
242
//
243
box-shadow: none;
244
background-color: transparent;
245
}
246
@else if $t==flat-checked {
247
//
248
// checked flat button
249
//
250
background-color: $track_color;
251
color: $fg_color;
252
}
253
@else if $t==flat-checked-insensitive {
254
//
255
// checked flat insensitive button
256
//
257
> .label { color: inherit; }
258
}
259
}
260
261
@mixin overshoot($p, $t:normal, $c:$secondary_selected_bg_color) {
262
//
263
// overshoot
264
//
265
// $p: position
266
// $t: type
267
// $c: base color
268
//
269
// possible $p values:
270
// top, bottom, right, left
271
//
272
// possible $t values:
273
// normal, backdrop
274
//
275
276
$_position: center $p;
277
278
@if ($p == left) or ($p == right) {
279
$_position: $p center;
280
}
281
282
background-image: -gtk-gradient(radial,
283
$_position, 0,
284
$_position, 0.75,
285
to(scale-alpha($c, $lower_opacity)),
286
to(transparent));
287
288
background-repeat: no-repeat;
289
background-position: $_position;
290
291
background-color: transparent; // reset some properties to be sure to not inherit them somehow
292
border: none; //
293
box-shadow: none; //
294
}
295
296
@mixin undershoot($p) {
297
//
298
// undershoot
299
//
300
// $p: position
301
//
302
// possible $p values:
303
// top, bottom, right, left
304
//
305
306
$_undershoot_color_dark: scale-alpha($fg_color, $lower_opacity);
307
$_undershoot_color_light: scale-alpha($base_color, $lower_opacity);
308
309
$_gradient_dir: left;
310
$_dash_bg_size: 16px 2px;
311
$_gradient_repeat: repeat-x;
312
$_bg_pos: center $p;
313
314
background-color: transparent; // shouldn't be needed, but better to be sure;
315
316
@if ($p == left) or ($p == right) {
317
$_gradient_dir: top;
318
$_dash_bg_size: 2px 16px;
319
$_gradient_repeat: repeat-y;
320
$_bg_pos: $p center;
321
}
322
323
background-image: linear-gradient(to $_gradient_dir, // this is the dashed line
324
$_undershoot_color_light 50%,
325
$_undershoot_color_dark 50%);
326
327
padding-#{$p}: 0;
328
background-size: $_dash_bg_size;
329
background-repeat: $_gradient_repeat;
330
background-origin: content-box;
331
background-position: $_bg_pos;
332
}
333