A fork of the Materia GTK theme.

Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

 _drawing.scss

View raw Download
text/plain • 6.54 kiB
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 100%);
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 0px;
46
box-shadow: inset 0 -1px if($fc == $primary, stroke($on-surface), $fc);
47
background-color: entry-fill($on-surface);
48
color: $on-surface;
49
caret-color: $fc;
50
}
51
52
@if $t == hover {
53
box-shadow: inset 0 -1px if($fc == $primary, stroke($on-surface), $fc);
54
background-color: hover-overlay($on-surface, $on: entry-fill($on-surface), $alt: true);
55
}
56
57
@if $t == focus {
58
box-shadow: inset 0 -1px if($fc == $primary, stroke($on-surface), $fc);
59
background-color: focus-overlay($on-surface, $on: entry-fill($on-surface));
60
}
61
62
@if $t == checked {
63
border-image:
64
radial-gradient(
65
circle closest-corner at center calc(100% - 1px),
66
$fc 100%,
67
transparent 100%
68
) 2 / 0 0 2px;
69
box-shadow: inset 0 -1px if($fc == $primary, stroke($on-surface), $fc);
70
background-color: focus-overlay($on-surface, $on: entry-fill($on-surface));
71
}
72
73
@if $t == disabled {
74
box-shadow: inset 0 -1px disabled-stroke($on-surface);
75
background-color: entry-fill($on-surface);
76
color: disabled($on-surface);
77
}
78
79
@if $t == raised-normal {
80
transition: $transition;
81
border-image: none;
82
box-shadow: $shadow-z1;
83
background-color: if($fc == $primary, $surface-z8, $fc);
84
color: if($fc == $primary, $on-surface, on($fc));
85
caret-color: if($fc == $primary, $fc, on($fc));
86
}
87
88
@if $t == raised-hover {
89
box-shadow: $shadow-z3;
90
}
91
92
@if $t == raised-focus {
93
border-image: none;
94
box-shadow: $shadow-z3;
95
}
96
97
@if $t == raised-disabled {
98
box-shadow: $shadow-z1;
99
background-color: $surface-z1;
100
color: disabled($on-surface);
101
}
102
}
103
104
105
$ripple-transition-property: all, border-image, background-size, background-image;
106
$ripple-transition-duration: $duration, $ripple-fade-in-duration, $ripple-fade-out-duration, $ripple-fade-out-opacity-duration;
107
$ripple-active-transition-duration: $duration, $ripple-fade-in-duration, 0ms, 0ms;
108
109
%ripple {
110
transition-property: $ripple-transition-property;
111
transition-duration: $ripple-transition-duration;
112
transition-timing-function: $ease-out;
113
background-image: radial-gradient(circle, transparent 10%, transparent 10%);
114
background-repeat: no-repeat;
115
background-position: center;
116
background-size: 1000% 1000%;
117
118
&:active {
119
transition-duration: $ripple-active-transition-duration;
120
animation: ripple $ripple-fade-in-duration $ease-out forwards;
121
background-size: 0% 0%;
122
}
123
}
124
125
@mixin ink-color($color, $on: transparent, $button-style: "none", $hover-alt: false, $opacity-modifier: 0) {
126
@if $button-style == "raised" {
127
$hover-alt: true;
128
}
129
130
@if $button-style == "flat" {
131
box-shadow: none;
132
} @else if $button-style == "outlined" {
133
box-shadow: inset 0 0 0 1px stroke($on-surface);
134
} @else if $button-style == "raised" {
135
box-shadow: $shadow-z2;
136
}
137
138
@if $button-style != "none" or $on != transparent {
139
background-color: $on;
140
}
141
142
&:drop(active),
143
&:hover {
144
@if $button-style == "flat" {
145
box-shadow: none;
146
} @else if $button-style == "outlined" {
147
box-shadow: inset 0 0 0 1px stroke($on-surface);
148
} @else if $button-style == "raised" {
149
box-shadow: $shadow-z4;
150
}
151
152
background-color: hover-overlay($color, $opacity-modifier: $opacity-modifier, $on: $on, $alt: $hover-alt);
153
}
154
155
&:focus {
156
@if $button-style == "flat" {
157
box-shadow: none;
158
} @else if $button-style == "outlined" {
159
box-shadow: inset 0 0 0 1px stroke($on-surface);
160
} @else if $button-style == "raised" {
161
box-shadow: $shadow-z4;
162
}
163
164
background-color: focus-overlay($color, $opacity-modifier: $opacity-modifier, $on: $on);
165
}
166
167
&:active {
168
@if $button-style == "flat" {
169
box-shadow: none;
170
} @else if $button-style == "outlined" {
171
box-shadow: inset 0 0 0 1px stroke($on-surface);
172
} @else if $button-style == "raised" {
173
box-shadow: $shadow-z8;
174
}
175
176
background-image: radial-gradient(circle, pressed-overlay($color, $opacity-modifier: $opacity-modifier) 10%, transparent 10%);
177
}
178
}
179
180
@mixin list-item {
181
&:drop(active):not(:active),
182
&:hover:not(:active) {
183
transition-property: $ripple-transition-property, background-color;
184
transition-duration: $ripple-transition-duration, 0ms;
185
}
186
}
187
188
189
@mixin overshoot($position) {
190
$valid-positions: top, bottom, left, right;
191
192
@if not index($valid-positions, $position) {
193
@error "#{$position} is not a valid position. Expected one of #{$valid-positions}.";
194
}
195
196
$background-size: 200% 75%;
197
198
@if $position == left or $position == right {
199
$background-size: 75% 200%;
200
}
201
202
background-image:
203
radial-gradient(
204
farthest-side at $position,
205
rgba($primary, .24) 99%, // For better antialiasing
206
rgba($primary, 0) 100% // Don't use transparent i.e. rgba(0, 0, 0, 0)
207
);
208
background-size: $background-size;
209
background-repeat: no-repeat;
210
background-position: $position;
211
}
212
213
214
@mixin undershoot($side) {
215
$valid-sides: top, bottom, left, right;
216
217
@if not index($valid-sides, $side) {
218
@error "#{$side} is not a valid side. Expected one of #{$valid-sides}.";
219
}
220
221
$_undershoot_color_dark: stroke($on-surface);
222
$_undershoot_color_light: transparent;
223
224
$_gradient_dir: left;
225
$_dash_bg_size: 12px 1px;
226
$_gradient_repeat: repeat-x;
227
$_bg_pos: left $side;
228
229
@if $side == left or $side == right {
230
$_gradient_dir: top;
231
$_dash_bg_size: 1px 12px;
232
$_gradient_repeat: repeat-y;
233
$_bg_pos: $side top;
234
}
235
236
background-color: transparent; // shouldn't be needed, but better to be sure
237
238
background-image: linear-gradient(to $_gradient_dir, // this is the dashed line
239
$_undershoot_color_light 50%,
240
$_undershoot_color_dark 50%);
241
242
margin-#{$side}: 1px;
243
background-size: $_dash_bg_size;
244
background-repeat: $_gradient_repeat;
245
background-origin: content-box;
246
background-position: $_bg_pos;
247
}
248