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-3.20.scss

View raw Download
text/plain • 5.66 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 0 0 9999px transparent, 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 0 0 9999px overlay("hover", $on-surface), inset 0 -1px if($fc == $primary, stroke($on-surface), $fc);
54
}
55
56
@if $t == focus {
57
box-shadow: inset 0 0 0 9999px overlay("focus", $on-surface), inset 0 -1px if($fc == $primary, stroke($on-surface), $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 disabled-stroke($on-surface);
71
background-color: entry-fill($on-surface);
72
color: disabled($on-surface);
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, $on-surface, 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: disabled($on-surface);
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 ink-color($color, $elevation: false, $opacity-modifier: 0) {
123
$hover: "hover";
124
125
@if $elevation {
126
$hover: "hover-alt";
127
}
128
129
box-shadow: inset 0 0 0 9999px transparent, if($elevation, $shadow-z2, null);
130
131
&:drop(active),
132
&:hover {
133
box-shadow: inset 0 0 0 9999px overlay($hover, $color, $opacity-modifier: $opacity-modifier), if($elevation, $shadow-z4, null);
134
}
135
136
&:focus {
137
box-shadow: inset 0 0 0 9999px overlay("focus", $color, $opacity-modifier: $opacity-modifier), if($elevation, $shadow-z4, null);
138
}
139
140
&:active {
141
@if $elevation {
142
box-shadow: inset 0 0 0 9999px overlay("focus", $color, $opacity-modifier: $opacity-modifier), $shadow-z8;
143
}
144
145
background-image: radial-gradient(circle, overlay("pressed", $color, $opacity-modifier: $opacity-modifier) 10%, transparent 0%);
146
}
147
}
148
149
@mixin list-item {
150
&:drop(active):not(:active),
151
&:hover:not(:active) {
152
transition-property: $ripple-transition-property, box-shadow;
153
transition-duration: $ripple-transition-duration, 0ms;
154
}
155
}
156
157
158
@mixin overshoot($side) {
159
$valid-sides: top, bottom, left, right;
160
161
@if not index($valid-sides, $side) {
162
@error "#{$side} is not a valid side. Expected one of #{$valid-sides}.";
163
}
164
165
$_position: center $side;
166
167
@if $side == left or $side == right {
168
$_position: $side center;
169
}
170
171
background-image:
172
-gtk-gradient(
173
radial,
174
$_position, 0,
175
$_position, .75,
176
to(rgba($primary, .24)),
177
to(transparent)
178
);
179
180
background-repeat: no-repeat;
181
background-position: $_position;
182
183
background-color: transparent; // reset some properties to be sure to not inherit them somehow
184
border: none; //
185
box-shadow: none; //
186
}
187
188
189
@mixin undershoot($side) {
190
$valid-sides: top, bottom, left, right;
191
192
@if not index($valid-sides, $side) {
193
@error "#{$side} is not a valid side. Expected one of #{$valid-sides}.";
194
}
195
196
$_undershoot_color_dark: stroke($on-surface);
197
$_undershoot_color_light: transparent;
198
199
$_gradient_dir: left;
200
$_dash_bg_size: 12px 1px;
201
$_gradient_repeat: repeat-x;
202
$_bg_pos: left $side;
203
204
@if $side == left or $side == right {
205
$_gradient_dir: top;
206
$_dash_bg_size: 1px 12px;
207
$_gradient_repeat: repeat-y;
208
$_bg_pos: $side top;
209
}
210
211
background-color: transparent; // shouldn't be needed, but better to be sure
212
213
background-image: linear-gradient(to $_gradient_dir, // this is the dashed line
214
$_undershoot_color_light 50%,
215
$_undershoot_color_dark 50%);
216
217
padding-#{$side}: 1px;
218
background-size: $_dash_bg_size;
219
background-repeat: $_gradient_repeat;
220
background-origin: content-box;
221
background-position: $_bg_pos;
222
}
223