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 • 6.61 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 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 -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: overlay("hover-alt", $on-surface, $on: entry-fill($on-surface));
55
}
56
57
@if $t == focus {
58
box-shadow: inset 0 -1px if($fc == $primary, stroke($on-surface), $fc);
59
background-color: overlay("focus", $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 0%
68
) 2 / 0 0 2px;
69
box-shadow: inset 0 -1px if($fc == $primary, stroke($on-surface), $fc);
70
background-color: overlay("focus", $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
outline: none;
114
background-image: radial-gradient(circle, transparent 10%, transparent 0%);
115
background-repeat: no-repeat;
116
background-position: center;
117
background-size: 1000% 1000%;
118
119
&:active {
120
transition-duration: $ripple-active-transition-duration;
121
animation: ripple $ripple-fade-in-duration $ease-out forwards;
122
background-size: 0% 0%;
123
}
124
}
125
126
@mixin ink-color($color, $on: transparent, $button-style: "none", $hover-alt: false, $opacity-modifier: 0) {
127
$hover: "hover";
128
129
@if $hover-alt or $button-style == "raised" {
130
$hover: "hover-alt";
131
}
132
133
@if $button-style == "flat" {
134
box-shadow: none;
135
} @else if $button-style == "outlined" {
136
box-shadow: inset 0 0 0 1px stroke($on-surface);
137
} @else if $button-style == "raised" {
138
box-shadow: $shadow-z2;
139
}
140
141
@if $button-style != "none" or $on != transparent {
142
background-color: $on;
143
}
144
145
&:drop(active),
146
&:hover {
147
@if $button-style == "flat" {
148
box-shadow: none;
149
} @else if $button-style == "outlined" {
150
box-shadow: inset 0 0 0 1px stroke($on-surface);
151
} @else if $button-style == "raised" {
152
box-shadow: $shadow-z4;
153
}
154
155
background-color: overlay($hover, $color, $opacity-modifier: $opacity-modifier, $on: $on);
156
}
157
158
&:focus {
159
@if $button-style == "flat" {
160
box-shadow: none;
161
} @else if $button-style == "outlined" {
162
box-shadow: inset 0 0 0 1px stroke($on-surface);
163
} @else if $button-style == "raised" {
164
box-shadow: $shadow-z4;
165
}
166
167
background-color: overlay("focus", $color, $opacity-modifier: $opacity-modifier, $on: $on);
168
}
169
170
&:active {
171
@if $button-style == "flat" {
172
box-shadow: none;
173
} @else if $button-style == "outlined" {
174
box-shadow: inset 0 0 0 1px stroke($on-surface);
175
} @else if $button-style == "raised" {
176
box-shadow: $shadow-z8;
177
}
178
179
background-image: radial-gradient(circle, overlay("pressed", $color, $opacity-modifier: $opacity-modifier) 10%, transparent 0%);
180
}
181
}
182
183
@mixin list-item {
184
&:drop(active):not(:active),
185
&:hover:not(:active) {
186
transition-property: $ripple-transition-property, background-color;
187
transition-duration: $ripple-transition-duration, 0ms;
188
}
189
}
190
191
192
@mixin overshoot($side) {
193
$valid-sides: top, bottom, left, right;
194
195
@if not index($valid-sides, $side) {
196
@error "#{$side} is not a valid side. Expected one of #{$valid-sides}.";
197
}
198
199
$_position: center $side;
200
201
@if $side == left or $side == right {
202
$_position: $side center;
203
}
204
205
background-image:
206
-gtk-gradient(
207
radial,
208
$_position, 0,
209
$_position, .75,
210
to(rgba($primary, .24)),
211
to(transparent)
212
);
213
214
background-repeat: no-repeat;
215
background-position: $_position;
216
217
background-color: transparent; // reset some properties to be sure to not inherit them somehow
218
border: none; //
219
box-shadow: none; //
220
}
221
222
223
@mixin undershoot($side) {
224
$valid-sides: top, bottom, left, right;
225
226
@if not index($valid-sides, $side) {
227
@error "#{$side} is not a valid side. Expected one of #{$valid-sides}.";
228
}
229
230
$_undershoot_color_dark: stroke($on-surface);
231
$_undershoot_color_light: transparent;
232
233
$_gradient_dir: left;
234
$_dash_bg_size: 12px 1px;
235
$_gradient_repeat: repeat-x;
236
$_bg_pos: left $side;
237
238
@if $side == left or $side == right {
239
$_gradient_dir: top;
240
$_dash_bg_size: 1px 12px;
241
$_gradient_repeat: repeat-y;
242
$_bg_pos: $side top;
243
}
244
245
background-color: transparent; // shouldn't be needed, but better to be sure
246
247
background-image: linear-gradient(to $_gradient_dir, // this is the dashed line
248
$_undershoot_color_light 50%,
249
$_undershoot_color_dark 50%);
250
251
padding-#{$side}: 1px;
252
background-size: $_dash_bg_size;
253
background-repeat: $_gradient_repeat;
254
background-origin: content-box;
255
background-position: $_bg_pos;
256
}
257