source: main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/styles/_material.scss@ 35441

Last change on this file since 35441 was 35441, checked in by cstephen, 3 years ago

Theme variable rework to allow for better color theming

File size: 7.1 KB
Line 
1////
2/// Defines themes that mimic the material design specification.
3/// @author Carl Stephens
4////
5
6/* === Start theme definitions === */
7
8$primary-bg-color-l1: #249ccf;
9$primary-bg-color: #2191c0;
10
11$accent-bg-color: #19769e;
12
13:root {
14 // Constant variables; do not modify in other styles
15 --primary-bg-color-l1: #{$primary-bg-color-l1};
16 --primary-bg-color: #{$primary-bg-color};
17 --primary-fg-color: white;
18
19 --accent-bg-color: #{$accent-bg-color};
20 --accent-fg-color: white;
21
22 --body-color: rgb(39, 39, 39);
23
24 --primary-box-shadow: 0 2px 4px 0 #505050;
25 --primary-box-shadow-thin: 0 1px 3px 0 #666666;
26
27 --hover-brightness: 92%;
28
29 --paper-color: #FCFCFC;
30
31 --border-radius: 0.3em;
32
33 --transition-duration: 0.15s;
34
35 // Normal variables - utilised by styles and set to one of the definitions above.
36 --bg-color: var(--primary-bg-color);
37 --fg-color: var(--primary-fg-color);
38 --box-shadow: var(--primary-box-shadow);
39}
40
41.theme-error {
42 --bg-color: #f04848;
43}
44
45.theme-flat {
46 --bg-color: transparent;
47 --fg-color: --primary-bg-color;
48 --box-shadow: none;
49
50 &:hover {
51 background-color: #EEE;
52 }
53}
54
55.theme-accent {
56 --bg-color: var(--accent-bg-color);
57 --fg-color: var(--accent-fg-color);
58}
59
60/* === End theme definitions */
61
62/* === Start component definitions === */
63
64.paper {
65 padding: 1.2em;
66 border-radius: var(--border-radius);
67
68 background-color: var(--paper-color);
69 color: var(--body-color);
70 box-shadow: var(--box-shadow);
71}
72
73.card {
74 @extend .paper;
75 --box-shadow: var(--primary-box-shadow-thin);
76}
77
78.card-outlined {
79 @extend .card;
80
81 box-shadow: none;
82 border: 1px solid #BBB;
83}
84
85.divider {
86 height: 1px;
87 background-color: #0000001F;
88 border: none;
89 margin: 1rem 2rem;
90}
91
92/* Buttons */
93
94.btn-primary {
95 display: flex;
96 align-items: center;
97 text-align: left;
98
99 background-color: var(--bg-color);
100 color: var(--fg-color);
101 border: none;
102 box-shadow: var(--box-shadow);
103
104 border-radius: var(--border-radius);
105 padding: 0.5em;
106 cursor: pointer;
107 font-size: 16px;
108 text-decoration: none;
109 margin: 0 1px 3px 1px; /* Keeps space around the box shadow */
110
111 transition-duration: var(--transition-duration);
112
113 &:hover {
114 filter: brightness(var(--hover-brightness));
115 }
116
117 &:disabled {
118 filter: grayscale(100%);
119 }
120}
121
122.btn-fab {
123 @extend .btn-primary;
124
125 border-radius: 50%;
126 padding: 0.3em;
127}
128
129/** Text display/input */
130
131.text-container {
132 display: flex;
133 align-items: center;
134 flex-wrap: wrap;
135
136 border-radius: var(--border-radius);
137 background: #DDD;
138 padding: 0.5em;
139}
140
141.text-container-sl {
142 @extend .text-container;
143
144 overflow-x: auto;
145 overflow-y: hidden;
146 white-space: nowrap;
147}
148
149.text-input {
150 @extend .text-container;
151
152 border-radius: var(--border-radius) var(--border-radius) 0 0;
153 border-bottom: 1px solid #AAA;
154 cursor: text;
155
156 transition-duration: var(--transition-duration);
157
158 &:hover {
159 background-color: #CDCDCD;
160 }
161
162 &:active, &:focus {
163 border-bottom: 1px solid var(--bg-color);
164
165 .text-input-active {
166 width: 100%;
167 }
168 }
169
170 .text-input-active {
171 background-color: var(--bg-color);
172 height: 1px;
173 margin: 0 auto;
174 width: 0;
175 transition-duration: var(--transition-duration);
176 }
177}
178
179.text-input-sl {
180 @extend .text-input;
181
182 overflow-x: auto;
183 overflow-y: hidden;
184 white-space: nowrap;
185}
186
187.text-placeholder {
188 color: #666;
189 cursor: inherit;
190 font-style: italic;
191 cursor: inherit;
192}
193
194/* Switches */
195
196// https://codepen.io/avstorm/pen/jOEpBLW
197.switch
198{
199 -webkit-appearance: none;
200 -moz-appearance: none;
201 appearance: none;
202
203 -webkit-tap-highlight-color: transparent;
204 cursor: pointer;
205
206 height: 16px;
207 width: 38px;
208 border-radius: 8px;
209 display: inline-block;
210 position: relative;
211 margin: 6px;
212 background-color: #c7c7c7;
213 transition-duration: var(--transition-duration);
214
215 &:focus {
216 outline: 0;
217 }
218
219 &::after {
220 content: '';
221 position: absolute;
222 display: inline-block;
223 top: -4px;
224 left: -4px;
225 width: 24px;
226 height: 24px;
227 border-radius: 50%;
228 background: white;
229 box-shadow: var(--primary-box-shadow-thin);
230 transition-duration: var(--transition-duration);
231 }
232
233 &:checked {
234 background-color: scale-color($primary-bg-color-l1, $alpha: -60%);
235
236 &::after {
237 transform: translatex(22px);
238 background-color: var(--primary-bg-color-l1);
239 }
240 }
241}
242
243/* Sliders */
244
245@mixin slider-clear {
246 appearance: none;
247 width: 100%; // Required for firefox
248
249 &::-webkit-slider-thumb {
250 -webkit-appearance: none;
251 }
252
253 &::-moz-range-track {
254 outline: none;
255 }
256
257 &::-ms-track {
258 width: 100%;
259 background: transparent;
260 border-color: transparent;
261 color: transparent;
262 }
263}
264
265@mixin slider-thumb {
266 height: 24px;
267 width: 24px;
268 border-radius: 50%;
269 cursor: pointer;
270
271 background-color: var(--bg-color);
272 box-shadow: var(--primary-box-shadow-thin);
273
274 &:hover {
275 filter: brightness(var(--hover-brightness));
276 }
277}
278
279@mixin disabled-slider-thumb {
280 cursor: default;
281
282 &:hover {
283 filter: none;
284 }
285}
286
287.slider-continuous {
288 @include slider-clear();
289
290 margin: 0;
291 padding: 0;
292 height: 8px;
293 border-radius: 4px;
294 background-color: scale-color($primary-bg-color-l1, $alpha: -70%);
295
296 transition-duration: var(--transition-duration);
297
298 &::-webkit-slider-thumb {
299 @include slider-thumb()
300 }
301
302 &::-moz-range-thumb {
303 @include slider-thumb()
304 }
305
306 &::-ms-thumb {
307 @include slider-thumb()
308 }
309
310 &:hover {
311 background-color: scale-color($primary-bg-color-l1, $alpha: -60%);
312 }
313}
314
315.slider-continuous:disabled {
316 filter: grayscale(100%);
317
318 &::-webkit-slider-thumb {
319 @include disabled-slider-thumb();
320 }
321
322 &::-moz-range-thumb {
323 @include disabled-slider-thumb();
324 }
325
326 &::-ms-thumb {
327 @include disabled-slider-thumb();
328 }
329
330 &:hover {
331 background-color: scale-color($primary-bg-color-l1, $alpha: -70%);
332 }
333}
334
335/* List Views */
336
337.list-view {
338 list-style-type: none;
339 margin-block: 0 0;
340 padding-inline: 0 0;
341}
342
343.list-view__item {
344 padding: 0.2em 0.5em;
345 transition-duration: var(--transition-duration);
346
347 &:hover {
348 background-color: #EEE;
349 }
350}
351
352/* === End component definitions === */
353
354/* Font sizes */
355
356.body0 {
357 font-size: 18px;
358 line-height: 24px;
359}
360
361.body1 {
362 font-size: 16px;
363}
364
365.body2 {
366 font-size: 14px;
367}
368
369.heading1 {
370 font-size: 40px;
371 font-weight: 300;
372}
373
374/* Scrollbar replacement */
375
376::-webkit-scrollbar {
377 width: 6px;
378 height: 6px;
379}
380
381::-webkit-scrollbar-track {
382 background: #f1f1f1;
383}
384
385::-webkit-scrollbar-thumb {
386 background: #CCC;
387 border-radius: 3px;
388
389 transition-duration: var(--transition-duration);
390
391 &:hover {
392 background: #666;
393 height: 8px;
394 width: 8px;
395 }
396}
Note: See TracBrowser for help on using the repository browser.