blob: 858077eaf79074219ed8fd513828bb31310ff5a0 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001/**
2 * Copyright 2015 Google Inc. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/* Typography */
18
19@mixin typo-preferred-font($usePreferred: true) {
20 @if $usePreferred {
21 font-family: $preferred_font;
22 }
23}
24
25@mixin typo-display-4($colorContrast: false, $usePreferred: true) {
26 @include typo-preferred-font($usePreferred);
27 font-size: 112px;
28 font-weight: 300;
29 line-height: 1;
30 letter-spacing: -0.04em;
31
32 @if $colorContrast {
33 opacity: 0.54;
34 }
35}
36
37@mixin typo-display-3($colorContrast: false, $usePreferred: true) {
38 @include typo-preferred-font($usePreferred);
39 font-size: 56px;
40 font-weight: 400;
41 line-height: 1.35;
42 letter-spacing: -0.02em;
43
44 @if $colorContrast {
45 opacity: 0.54;
46 }
47}
48
49@mixin typo-display-2($colorContrast: false, $usePreferred: true) {
50 @include typo-preferred-font($usePreferred);
51 font-size: 45px;
52 font-weight: 400;
53 line-height: 48px;
54
55 @if $colorContrast {
56 opacity: 0.54;
57 }
58}
59
60@mixin typo-display-1($colorContrast: false, $usePreferred: true) {
61 @include typo-preferred-font($usePreferred);
62 font-size: 34px;
63 font-weight: 400;
64 line-height: 40px;
65
66 @if $colorContrast {
67 opacity: 0.54;
68 }
69}
70
71@mixin typo-headline($colorContrast: false, $usePreferred: true) {
72 @include typo-preferred-font($usePreferred);
73 font-size: 24px;
74 font-weight: 400;
75 line-height: 32px;
76 -moz-osx-font-smoothing: grayscale;
77
78 @if $colorContrast {
79 opacity: 0.87;
80 }
81}
82
83@mixin typo-title($colorContrast: false, $usePreferred: true) {
84 @include typo-preferred-font($usePreferred);
85 font-size: 20px;
86 font-weight: 500;
87 line-height: 1;
88 letter-spacing: 0.02em;
89
90 @if $colorContrast {
91 opacity: 0.87;
92 }
93}
94
95@mixin typo-subhead($colorContrast: false, $usePreferred: true) {
96 @include typo-preferred-font($usePreferred);
97 font-size: 16px;
98 font-weight: 400;
99 line-height: 24px;
100 letter-spacing: 0.04em;
101
102 @if $colorContrast {
103 opacity: 0.87;
104 }
105}
106
107@mixin typo-subhead-2($colorContrast: false, $usePreferred: true) {
108 @include typo-preferred-font($usePreferred);
109 font-size: 16px;
110 font-weight: 400;
111 line-height: 28px;
112 letter-spacing: 0.04em;
113
114 @if $colorContrast {
115 opacity: 0.87;
116 }
117}
118
119@mixin typo-body-2($colorContrast: false, $usePreferred: false) {
120 @include typo-preferred-font($usePreferred);
121 font-size: 14px;
122 @if $usePreferred {
123 font-weight: 500;
124 } @else {
125 font-weight: bold;
126 }
127 line-height: 24px;
128 letter-spacing: 0;
129
130 @if $colorContrast {
131 opacity: 0.87;
132 }
133}
134
135@mixin typo-body-1($colorContrast: false, $usePreferred: false) {
136 @include typo-preferred-font($usePreferred);
137 font-size: 14px;
138 font-weight: 400;
139 line-height: 24px;
140 letter-spacing: 0;
141
142 @if $colorContrast {
143 opacity: 0.87;
144 }
145}
146
147@mixin typo-caption($colorContrast: false, $usePreferred: false) {
148 @include typo-preferred-font($usePreferred);
149 font-size: 12px;
150 font-weight: 400;
151 line-height: 1;
152 letter-spacing: 0;
153
154 @if $colorContrast {
155 opacity: 0.54;
156 }
157}
158
159@mixin typo-blockquote($colorContrast: false, $usePreferred: true) {
160 @include typo-preferred-font($usePreferred);
161 position: relative;
162 font-size: 24px;
163 font-weight: 300;
164 font-style: italic;
165 line-height: 1.35;
166 letter-spacing: 0.08em;
167
168 &:before {
169 position: absolute;
170 left: -0.5em;
171 content: '“';
172 }
173
174 &:after {
175 content: '”';
176 margin-left: -0.05em;
177 }
178
179 @if $colorContrast {
180 opacity: 0.54;
181 }
182}
183
184@mixin typo-menu($colorContrast: false, $usePreferred: true) {
185 @include typo-preferred-font($usePreferred);
186 font-size: 14px;
187 font-weight: 500;
188 line-height: 1;
189 letter-spacing: 0;
190
191 @if $colorContrast {
192 opacity: 0.87;
193 }
194}
195
196@mixin typo-button($colorContrast: false, $usePreferred: true) {
197 @include typo-preferred-font($usePreferred);
198 font-size: 14px;
199 font-weight: 500;
200 text-transform: uppercase;
201 line-height: 1;
202 letter-spacing: 0;
203
204 @if $colorContrast {
205 opacity: 0.87;
206 }
207}
208
209@mixin typo-icon() {
210 font-family: 'Material Icons';
211 font-weight: normal;
212 font-style: normal;
213 font-size: 24px;
214 line-height: 1;
215 letter-spacing: normal;
216 text-transform: none;
217 display: inline-block;
218 word-wrap: normal;
219 font-feature-settings: 'liga';
220 -webkit-font-feature-settings: 'liga';
221 -webkit-font-smoothing: antialiased;
222}
223
224/* Shadows */
225
226// Focus shadow mixin.
227@mixin focus-shadow() {
228 box-shadow: 0 0 8px rgba(0,0,0,.18),0 8px 16px rgba(0,0,0,.36);
229}
230
231@mixin shadow-2dp() {
232 box-shadow: 0 2px 2px 0 rgba(0, 0, 0, $shadow-key-penumbra-opacity),
233 0 3px 1px -2px rgba(0, 0, 0, $shadow-key-umbra-opacity),
234 0 1px 5px 0 rgba(0, 0, 0, $shadow-ambient-shadow-opacity);
235}
236@mixin shadow-3dp() {
237 box-shadow: 0 3px 4px 0 rgba(0, 0, 0, $shadow-key-penumbra-opacity),
238 0 3px 3px -2px rgba(0, 0, 0, $shadow-key-umbra-opacity),
239 0 1px 8px 0 rgba(0, 0, 0, $shadow-ambient-shadow-opacity);
240}
241@mixin shadow-4dp() {
242 box-shadow: 0 4px 5px 0 rgba(0, 0, 0, $shadow-key-penumbra-opacity),
243 0 1px 10px 0 rgba(0, 0, 0, $shadow-ambient-shadow-opacity),
244 0 2px 4px -1px rgba(0, 0, 0, $shadow-key-umbra-opacity);
245}
246@mixin shadow-6dp() {
247 box-shadow: 0 6px 10px 0 rgba(0, 0, 0, $shadow-key-penumbra-opacity),
248 0 1px 18px 0 rgba(0, 0, 0, $shadow-ambient-shadow-opacity),
249 0 3px 5px -1px rgba(0, 0, 0, $shadow-key-umbra-opacity);
250}
251@mixin shadow-8dp() {
252 box-shadow: 0 8px 10px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
253 0 3px 14px 2px rgba(0, 0, 0, $shadow-ambient-shadow-opacity),
254 0 5px 5px -3px rgba(0, 0, 0, $shadow-key-umbra-opacity);
255}
256
257@mixin shadow-16dp() {
258 box-shadow: 0 16px 24px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
259 0 6px 30px 5px rgba(0, 0, 0, $shadow-ambient-shadow-opacity),
260 0 8px 10px -5px rgba(0, 0, 0, $shadow-key-umbra-opacity);
261}
262
263@mixin shadow-24dp() {
264 box-shadow: 0 9px 46px 8px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
265 0 11px 15px -7px rgba(0, 0, 0, $shadow-ambient-shadow-opacity),
266 0 24px 38px 3px rgba(0, 0, 0, $shadow-key-umbra-opacity);
267}
268
269/* Animations */
270
271@mixin material-animation-fast-out-slow-in($duration:0.2s) {
272 transition-duration: $duration;
273 transition-timing-function: $animation-curve-fast-out-slow-in;
274}
275
276@mixin material-animation-linear-out-slow-in($duration:0.2s) {
277 transition-duration: $duration;
278 transition-timing-function: $animation-curve-linear-out-slow-in;
279}
280
281@mixin material-animation-fast-out-linear-in($duration:0.2s) {
282 transition-duration: $duration;
283 transition-timing-function: $animation-curve-fast-out-linear-in;
284}
285
286@mixin material-animation-default($duration:0.2s) {
287 transition-duration: $duration;
288 transition-timing-function: $animation-curve-default;
289}
290
291/* Dialog */
292
293@mixin dialog-width($units:5) {
294 @if(type_of($units) != 'number') {
295 @error "The unit given to dialog-width should be a number.";
296 }
297 // 56dp is the base unit width for Dialogs.
298 // With 5 units being the number of units for a mobile device.
299 // https://goo.gl/sK2O5o
300 width: $units * 56px;
301}