source: main/trunk/model-interfaces-dev/atea/ocr/src/styles/_material.scss@ 35749

Last change on this file since 35749 was 35749, checked in by cstephen, 2 years ago

Improve editing action buttons

File size: 9.5 KB
Line 
1////
2/// Defines themes that mimic the material design specification.
3/// @author Carl Stephens
4////
5
6:root {
7 // Set these to adjust the colour palette
8 --primary-bg-color-l1: 36, 156, 207;
9 --primary-bg-color: 33, 145, 192;
10 --primary-fg-color: 255, 255, 255;
11
12 --accent-bg-color: 25, 118, 158;
13 --accent-fg-color: 255, 255, 255;
14
15 // For components that are in a disabled state.
16 --primary-disabled-color-raw: 130, 130, 130;
17 // Main font color
18 --body-color: rgb(39, 39, 39);
19 // For the paper style, but more generally the neutral background color
20 --paper-color: #FCFCFC;
21
22 --body-font-family: Arial, sans-serif;
23
24 --primary-box-shadow: 0 2px 4px 0 #505050;
25 --primary-box-shadow-thin: 0 1px 3px 0 #666666;
26
27 // The brightness to reduce participating elements to on hover
28 --hover-brightness: 92%;
29 --border-radius: 0.3em;
30 --transition-duration: 0.15s;
31
32 // Default theme
33 @extend .theme-primary;
34}
35
36/* Scrollbar replacement */
37
38::-webkit-scrollbar {
39 width: 8px;
40 height: 8px;
41}
42
43::-webkit-scrollbar-track {
44 background: #f1f1f1;
45}
46
47::-webkit-scrollbar-thumb {
48 background: #CCC;
49 border-radius: 3px;
50
51 transition-duration: var(--transition-duration);
52
53 &:hover {
54 background: #666;
55 height: 8px;
56 width: 8px;
57 }
58}
59
60/* === Start component definitions === */
61
62.paper {
63 padding: 1.2em;
64 border-radius: var(--border-radius);
65 overflow: hidden;
66
67 background-color: var(--paper-color);
68 color: var(--body-color);
69 box-shadow: var(--primary-box-shadow);
70}
71
72.card {
73 @extend .paper;
74 box-shadow: var(--primary-box-shadow-thin);
75}
76
77.card-outlined {
78 @extend .card;
79
80 box-shadow: none;
81 border: 1px solid #BBB;
82}
83
84.divider {
85 height: 1px;
86 background-color: #0000001F;
87 border: none;
88 margin: 1rem 2rem;
89}
90
91.divider-s {
92 @extend .divider;
93 margin: 0 2rem;
94}
95
96/* Buttons */
97
98.btn-primary {
99 appearance: none;
100
101 display: flex;
102 align-items: center;
103 justify-content: center;
104
105 background-color: var(--bg-color);
106 color: var(--fg-color);
107 border: none;
108 box-shadow: var(--primary-box-shadow-thin);
109 border-radius: var(--border-radius);
110 padding: 0.5em;
111
112 cursor: pointer;
113 font-size: 1rem;
114 font-weight: 400;
115 text-decoration: none;
116
117 transition-duration: var(--transition-duration);
118
119 &:hover {
120 filter: brightness(var(--hover-brightness));
121 }
122
123 &:disabled {
124 cursor: default;
125 background-color: var(--disabled-color);
126 }
127}
128
129.btn-fab {
130 @extend .btn-primary;
131
132 border-radius: 50%;
133 padding: 0.3em;
134}
135
136/** Text display/input */
137
138.text-container {
139 display: flex;
140 flex-wrap: wrap;
141 align-content: flex-start;
142 align-items: flex-start;
143
144 border-radius: var(--border-radius);
145 background: #DDD;
146 padding: 0.5em;
147}
148
149.text-container-sl {
150 @extend .text-container;
151
152 align-items: center;
153 overflow-x: auto;
154 overflow-y: hidden;
155 white-space: nowrap;
156}
157
158.text-input {
159 @extend .text-container;
160
161 border-radius: var(--border-radius) var(--border-radius) 0 0;
162 border: none;
163 border-bottom: 2px solid #999;
164 outline: none;
165 cursor: text;
166
167 font-family: var(--body-font-family);
168 font-size: 1em;
169
170 transition: border var(--transition-duration);
171
172 &:hover {
173 background-color: #CDCDCD;
174 }
175
176 &:active, &:focus, &:focus-visible {
177 background-color: #CDCDCD;
178 border-bottom: 2px solid var(--bg-color);
179
180 .text-input-active {
181 width: 100%;
182 }
183 }
184
185 .text-input-active {
186 background-color: var(--bg-color);
187 height: 1px;
188 margin: 0 auto;
189 width: 0;
190 transition-duration: var(--transition-duration);
191 }
192}
193
194.text-input-sl {
195 @extend .text-input;
196
197 align-items: center;
198 overflow-x: auto;
199 overflow-y: hidden;
200 white-space: nowrap;
201}
202
203.text-placeholder {
204 color: #666;
205 cursor: inherit;
206 font-style: italic;
207 cursor: inherit;
208 user-select: none;
209}
210
211/* Switches */
212
213// https://codepen.io/avstorm/pen/jOEpBLW
214.switch
215{
216 -webkit-appearance: none;
217 -moz-appearance: none;
218 appearance: none;
219
220 -webkit-tap-highlight-color: transparent;
221 cursor: pointer;
222
223 height: 16px;
224 width: 38px;
225 border-radius: 8px;
226 display: inline-block;
227 position: relative;
228 margin: 6px;
229 background-color: #c7c7c7;
230 transition-duration: var(--transition-duration);
231
232 &:focus {
233 outline: 0;
234 }
235
236 &::after {
237 content: '';
238 position: absolute;
239 display: inline-block;
240 top: -4px;
241 left: -4px;
242 width: 24px;
243 height: 24px;
244 border-radius: 50%;
245 background: white;
246 box-shadow: var(--primary-box-shadow-thin);
247 transition-duration: var(--transition-duration);
248 }
249
250 &:checked {
251 background-color: rgba(var(--bg-color-raw), 0.4);
252
253 &::after {
254 transform: translatex(22px);
255 background-color: var(--bg-color);
256 }
257 }
258
259 &:disabled {
260 &::after {
261 background: #c7c7c7;
262 }
263 }
264}
265
266/* Sliders */
267
268@mixin slider-clear {
269 appearance: none;
270 width: 100%; // Required for firefox
271
272 &::-webkit-slider-thumb {
273 -webkit-appearance: none;
274 }
275
276 &::-moz-range-track {
277 outline: none;
278 }
279
280 &::-ms-track {
281 width: 100%;
282 background: transparent;
283 border-color: transparent;
284 color: transparent;
285 }
286}
287
288@mixin slider-thumb {
289 height: 24px;
290 width: 24px;
291 border-radius: 50%;
292 cursor: pointer;
293
294 background-color: var(--bg-color);
295 box-shadow: var(--primary-box-shadow-thin);
296
297 &:hover {
298 filter: brightness(var(--hover-brightness));
299 }
300}
301
302@mixin disabled-slider-thumb {
303 cursor: default;
304 background-color: var(--disabled-color);
305
306 &:hover {
307 filter: none;
308 }
309}
310
311.slider-continuous {
312 @include slider-clear();
313
314 margin: 0;
315 padding: 0;
316 height: 8px;
317 border-radius: 4px;
318 background-color: rgba(var(--bg-color-raw), 0.3);
319
320 transition-duration: var(--transition-duration);
321
322 &::-webkit-slider-thumb {
323 @include slider-thumb()
324 }
325
326 &::-moz-range-thumb {
327 @include slider-thumb()
328 }
329
330 &::-ms-thumb {
331 @include slider-thumb()
332 }
333
334 &:hover {
335 background-color: rgba(var(--bg-color-raw), 0.4);
336 }
337}
338
339.slider-continuous:disabled {
340 background-color: var(--disabled-color);
341
342 &::-webkit-slider-thumb {
343 @include disabled-slider-thumb();
344 }
345
346 &::-moz-range-thumb {
347 @include disabled-slider-thumb();
348 }
349
350 &::-ms-thumb {
351 @include disabled-slider-thumb();
352 }
353
354 &:hover {
355 background-color: var(--disabled-color);
356 }
357}
358
359/* List Views */
360
361.list-view {
362 list-style-type: none;
363 margin-block: 0 0;
364 padding-inline: 0 0;
365}
366
367.list-view__item {
368 padding: 0.2em 0.5em;
369 transition-duration: var(--transition-duration);
370
371 &:hover {
372 background-color: #EEE;
373 }
374}
375
376/* Progress Bars */
377
378.progress-circle-indeterminate {
379 height: 2em;
380 width: 2em;
381
382 border: 0.25em solid var(--bg-color);
383 border-right: 0.25em solid rgba(var(--bg-color-raw), 0.3);
384 border-radius: 50%;
385
386 animation: rotate360 1.5s linear 0s infinite running;
387}
388
389@keyframes rotate360 {
390 0% {
391 transform: rotate(0deg);
392 }
393
394 100% {
395 transform: rotate(360deg);
396 }
397}
398
399.progress-bar-container {
400 width: 100%;
401 height: 8px;
402 overflow: hidden;
403
404 background-color: rgba(var(--bg-color-raw), 0.2);
405 border-radius: 4px;
406}
407
408.progress-bar-value {
409 height: 100%;
410
411 background-color: var(--bg-color);
412 border-radius: 4px;
413}
414
415.progress-bar-indeterminate {
416 width: 20%;
417 animation: 2s ease 0s infinite alternate prgbr-indeterminate;
418}
419
420@keyframes prgbr-indeterminate {
421 0% {
422 transform: translateX(-100%);
423 }
424
425 100% {
426 transform: translateX(500%);
427 }
428}
429
430/* === End component definitions === */
431
432/* Font sizes */
433
434.body0 {
435 font-size: 18px;
436 line-height: 24px;
437}
438
439.body1 {
440 font-size: 16px;
441}
442
443.body2 {
444 font-size: 14px;
445}
446
447.heading1 {
448 font-size: 40px;
449 font-weight: 300;
450}
451
452/* === Start Theme Definitions === */
453
454.theme-primary {
455 --bg-color: rgb(var(--primary-bg-color));
456 --bg-color-raw: var(--primary-bg-color);
457 --fg-color: rgb(var(--primary-fg-color));
458 --fg-color-faw: var(--primary-fg-color);
459
460 --disabled-color: rgb(var(--primary-disabled-color-raw));
461 --disabled-color-raw: var(--primary-disabled-color-raw);
462}
463
464.theme-primary-l1 {
465 --bg-color: rgb(var(--primary-bg-color-l1));
466 --bg-color-raw: var(--primary-bg-color-l1);
467 --fg-color: rgb(var(--primary-fg-color));
468 --fg-color-raw: var(--primary-fg-color);
469}
470
471.theme-error {
472 --bg-color: #f04848;
473 --bg-color-raw: 240, 72, 72;
474}
475
476.theme-flat {
477 --bg-color: transparent;
478 --bg-color-raw: transparent;
479 --fg-color: rgb(var(--primary-bg-color));
480 --fg-color-raw: var(--primary-bg-color);
481
482 --disabled-color: transparent;
483 --disabled-color-raw: transparent;
484
485 box-shadow: none;
486
487 &:hover {
488 --bg-color: rgba(var(--primary-bg-color), 0.15);
489 }
490
491 &:disabled {
492 --fg-color: rgb(var(--primary-disabled-color-raw));
493 --fg-color-raw: var(--primary-disabled-color-raw);
494 }
495}
496
497.theme-accent {
498 --bg-color: rgb(var(--accent-bg-color));
499 --bg-color-raw: var(--accent-bg-color);
500 --fg-color: rgb(var(--accent-fg-color));
501 --fg-color-raw: var(--accent-fg-color);
502}
503
504/* === End theme definitions === */
Note: See TracBrowser for help on using the repository browser.