@inchurch/matcha-theme 20.277.0 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,918 +2,16 @@
2
2
  @use "sass:color";
3
3
 
4
4
  // -------------------------------------------------------------------------------------------------------------------
5
- // @ Theme functions
5
+ // @ Theme functions — REMOVIDAS no major (API velha)
6
6
  // --------------------------------------------------------------------------------------------------------------------
7
- // For a given hue in a palette, return the contrast color from the map of contrast palettes.
8
- // @param $color-map
9
- // @param $hue
10
- @function map-contrast($palette, $hue) {
11
- @return map.get(map.get($palette, contrast), $hue);
12
- }
13
-
14
- // Creates a map of hues to colors for a theme. This is used to define a theme palette in terms
15
- // of the Material Design hues.
16
- // @param $color-map
17
- // @param $primary
18
- // @param $lighter
19
- @function palette($base-palette, $default: 500, $lighter: 100, $darker: 700) {
20
- $result: map.merge($base-palette,
21
- (default: map.get($base-palette, $default),
22
- lighter: map.get($base-palette, $lighter),
23
- darker: map.get($base-palette, $darker),
24
- default-contrast: map-contrast($base-palette, $default),
25
- lighter-contrast: map-contrast($base-palette, $lighter),
26
- darker-contrast: map-contrast($base-palette, $darker)));
27
-
28
- // For each hue in the palette, add a "-contrast" color to the map.
29
- @each $hue, $color in $base-palette {
30
- $result: map.merge($result,
31
- ("#{$hue}-contrast": map-contrast($base-palette, $hue)));
32
- }
33
-
34
- @return $result;
35
- }
36
-
37
- @function getAllPalettes($theme) {
38
- $primary: map.get($theme, primary);
39
- $accent: map.get($theme, accent);
40
- $danger: map.get($theme, danger);
41
- $warn: map.get($theme, warn);
42
- $success: map.get($theme, success);
43
- $info: map.get($theme, info);
44
-
45
- // base colors
46
- $palettes: (
47
- red: $red,
48
- pink: $pink,
49
- purple: $purple,
50
- deep-purple: $deep-purple,
51
- indigo: $indigo,
52
- blue: $blue,
53
- light-blue: $light-blue,
54
- cyan: $cyan,
55
- teal: $teal,
56
- green: $green,
57
- light-green: $light-green,
58
- lime: $lime,
59
- yellow: $yellow,
60
- amber: $amber,
61
- orange: $orange,
62
- deep-orange: $deep-orange,
63
- brown: $brown,
64
- grey: $grey,
65
- blue-grey: $blue-grey,
66
- light-grey: $light-grey,
67
- dark-grey: $dark-grey,
68
- primary: $primary,
69
- accent: $accent,
70
- danger: $danger,
71
- warn: $warn,
72
- success: $success,
73
- info: $info
74
- );
75
- @return $palettes;
76
- }
77
-
78
- @function getShade($theme) {
79
- $is-dark: map.get($theme, is-dark);
80
- $get-shade: if($is-dark, 100, 500); // Define $red-shade com base no valor de $is-dark
81
- @return $get-shade;
82
- }
83
-
84
- // Background
85
- @function getBackground($theme) {
86
- $background: map.get($theme, background);
87
- $background: map.get($background, background);
88
- @return $background;
89
- }
90
-
91
- @function getBackgroundAlpha($theme) {
92
- $background: map.get($theme, background);
93
- $background-color: map.get($background, background-alpha);
94
- @return $background-color;
95
- }
96
-
97
- @function getBackgroundInverse($theme) {
98
- $background: map.get($theme, background);
99
- $background-inverse: map.get($background, background-inverse);
100
- @return $background-inverse;
101
- }
102
-
103
- @function getBackgroundAlphaInverse($theme) {
104
- $background: map.get($theme, background);
105
- $background-color: map.get($background, background-alpha-inverse);
106
- @return $background-color;
107
- }
108
-
109
- // Surface
110
- @function getSurface($theme) {
111
- $background: map.get($theme, background);
112
- $surface: map.get($background, card);
113
- @return $surface;
114
- }
115
-
116
- @function getSurfaceAlpha($theme) {
117
- $background: map.get($theme, background);
118
- $surface-color: map.get($background, card-alpha);
119
- @return $surface-color;
120
- }
121
-
122
- @function getSurfaceInverse($theme) {
123
- $background: map.get($theme, background);
124
- $surface-inverse: map.get($background, card-inverse);
125
- @return $surface-inverse;
126
- }
127
-
128
- @function getSurfaceAlphaInverse($theme) {
129
- $background: map.get($theme, background);
130
- $surface-color: map.get($background, card-alpha-inverse);
131
- @return $surface-color;
132
- }
133
-
134
-
135
- // Foreground
136
- @function getForeground($theme) {
137
- $foreground: map.get($theme, foreground);
138
- @return map.get($foreground, foreground);
139
- }
140
-
141
- @function getForegroundAlpha($theme) {
142
- $foreground: map.get($theme, foreground);
143
- @return map.get($foreground, foreground-alpha);
144
- }
145
-
146
- @function getForegroundInverse($theme) {
147
- $is-dark: map.get($theme, is-dark);
148
-
149
- @if $is-dark {
150
- @return $color-base-blue-grey-900; // Cor clara para tema light
151
- }
152
-
153
- @else {
154
- @return $color-base-blue-grey-100; // Cor escura para tema dark
155
- }
156
- }
157
-
158
- @function getForegroundAlphaInverse($theme) {
159
- $is-dark: map.get($theme, is-dark);
160
-
161
- @if $is-dark {
162
- @return rgba($color-base-blue-grey-900, 0.1); // Cor clara para tema light
163
- }
164
-
165
- @else {
166
- @return rgba($color-base-blue-grey-100, 0.1); // Cor escura para tema dark
167
- }
168
- }
169
-
170
-
171
- // Disabled
172
- // #D4DDE3
173
- @function getDisabled($theme) {
174
- $background: map.get($theme, background);
175
- $disabled: map.get($background, disabled);
176
- @return $disabled;
177
- }
178
-
179
- @function getDisabledBgContrast($theme) {
180
- $foreground: map.get($theme, foreground);
181
- $disabled-contrast: map.get($foreground, disabled-contrast);
182
- @return $disabled-contrast;
183
- }
184
-
185
- // rgba(0, 0, 0, 0.26),
186
- @function getDisabledContrast($theme) {
187
- $foreground: map.get($theme, foreground);
188
- $disabled-contrast: map.get($foreground, disabled);
189
- @return $disabled-contrast;
190
- }
191
-
192
- // #D4DDE3 50%
193
- @function getDisabledAlpha($theme) {
194
- $background: map.get($theme, background);
195
- $disabled-color: map.get($background, disabled-alpha);
196
- @return $disabled-color;
197
- }
198
-
199
- // rgba(0, 0, 0, 0.13)
200
- @function getDisabledContrastAlpha($theme) {
201
- $foreground: map.get($theme, foreground);
202
- $disabled-contrast-alpha: rgba(map.get($foreground, disabled), 0.5);
203
- @return $disabled-contrast-alpha;
204
- }
205
-
206
- // --------------------------------------------------------------------------------------------------------------------
207
- // Colors
208
- // --------------------------------------------------------------------------------------------------------------------
209
- // Red
210
- @function getRed($theme) {
211
- $red-color: map.get($red, getShade($theme));
212
- @return $red-color;
213
- }
214
-
215
- @function getRedContrast($theme) {
216
- $red-contrast-palette: map.get($red, 'contrast');
217
- $red-contrast: map.get($red-contrast-palette, getShade($theme));
218
- @return $red-contrast;
219
- }
220
-
221
- @function getRedAlpha($theme) {
222
- $red-color: getRed($theme);
223
- $red-color-alpha: rgba($red-color, 0.1);
224
- @return $red-color-alpha;
225
- }
226
-
227
- @function getRedContrastAlpha($theme) {
228
- $red-contrast: getRedContrast($theme);
229
- $red-contrast-alpha: rgba($red-contrast, 0.1);
230
- @return $red-contrast-alpha;
231
- }
232
-
233
- // Pink
234
- @function getPink($theme) {
235
- $pink-color: map.get($pink, getShade($theme));
236
- @return $pink-color;
237
- }
238
-
239
- @function getPinkContrast($theme) {
240
- $pink-contrast-palette: map.get($pink, 'contrast');
241
- $pink-contrast: map.get($pink-contrast-palette, getShade($theme));
242
- @return $pink-contrast;
243
- }
244
-
245
- @function getPinkAlpha($theme) {
246
- $pink-color: getPink($theme);
247
- $pink-color-alpha: rgba($pink-color, 0.1);
248
- @return $pink-color-alpha;
249
- }
250
-
251
- @function getPinkContrastAlpha($theme) {
252
- $pink-contrast: getPinkContrast($theme);
253
- $pink-contrast-alpha: rgba($pink-contrast, 0.1);
254
- @return $pink-contrast-alpha;
255
- }
256
-
257
- // Purple
258
- @function getPurple($theme) {
259
- $purple-color: map.get($purple, getShade($theme));
260
- @return $purple-color;
261
- }
262
-
263
- @function getPurpleContrast($theme) {
264
- $purple-contrast-palette: map.get($purple, 'contrast');
265
- $purple-contrast: map.get($purple-contrast-palette, getShade($theme));
266
- @return $purple-contrast;
267
- }
268
-
269
- @function getPurpleAlpha($theme) {
270
- $purple-color: getPurple($theme);
271
- $purple-color-alpha: rgba($purple-color, 0.1);
272
- @return $purple-color-alpha;
273
- }
274
-
275
- @function getPurpleContrastAlpha($theme) {
276
- $purple-contrast: getPurpleContrast($theme);
277
- $purple-contrast-alpha: rgba($purple-contrast, 0.1);
278
- @return $purple-contrast-alpha;
279
- }
280
-
281
- // Deep Purple
282
- @function getDeepPurple($theme) {
283
- $deep-purple-color: map.get($deep-purple, getShade($theme));
284
- @return $deep-purple-color;
285
- }
286
-
287
- @function getDeepPurpleContrast($theme) {
288
- $deep-purple-contrast-palette: map.get($deep-purple, 'contrast');
289
- $deep-purple-contrast: map.get($deep-purple-contrast-palette, getShade($theme));
290
- @return $deep-purple-contrast;
291
- }
292
-
293
- @function getDeepPurpleAlpha($theme) {
294
- $deep-purple-color: getDeepPurple($theme);
295
- $deep-purple-color-alpha: rgba($deep-purple-color, 0.1);
296
- @return $deep-purple-color-alpha;
297
- }
298
-
299
- @function getDeepPurpleContrastAlpha($theme) {
300
- $deep-purple-contrast: getDeepPurpleContrast($theme);
301
- $deep-purple-contrast-alpha: rgba($deep-purple-contrast, 0.1);
302
- @return $deep-purple-contrast-alpha;
303
- }
304
-
305
- // Indigo
306
- @function getIndigo($theme) {
307
- $indigo-color: map.get($indigo, getShade($theme));
308
- @return $indigo-color;
309
- }
310
-
311
- @function getIndigoContrast($theme) {
312
- $indigo-contrast-palette: map.get($indigo, 'contrast');
313
- $indigo-contrast: map.get($indigo-contrast-palette, getShade($theme));
314
- @return $indigo-contrast;
315
- }
316
-
317
- @function getIndigoAlpha($theme) {
318
- $indigo-color: getIndigo($theme);
319
- $indigo-color-alpha: rgba($indigo-color, 0.1);
320
- @return $indigo-color-alpha;
321
- }
322
-
323
- @function getIndigoContrastAlpha($theme) {
324
- $indigo-contrast: getIndigoContrast($theme);
325
- $indigo-contrast-alpha: rgba($indigo-contrast, 0.1);
326
- @return $indigo-contrast-alpha;
327
- }
328
-
329
- // Blue
330
- @function getBlue($theme) {
331
- $blue-color: map.get($blue, getShade($theme));
332
- @return $blue-color;
333
- }
334
-
335
- @function getBlueContrast($theme) {
336
- $blue-contrast-palette: map.get($blue, 'contrast');
337
- $blue-contrast: map.get($blue-contrast-palette, getShade($theme));
338
- @return $blue-contrast;
339
- }
340
-
341
- @function getBlueAlpha($theme) {
342
- $blue-color: getBlue($theme);
343
- $blue-color-alpha: rgba($blue-color, 0.1);
344
- @return $blue-color-alpha;
345
- }
346
-
347
- @function getBlueContrastAlpha($theme) {
348
- $blue-contrast: getBlueContrast($theme);
349
- $blue-contrast-alpha: rgba($blue-contrast, 0.1);
350
- @return $blue-contrast-alpha;
351
- }
352
-
353
- // Light Blue
354
- @function getLightBlue($theme) {
355
- $light-blue-color: map.get($light-blue, getShade($theme));
356
- @return $light-blue-color;
357
- }
358
-
359
- @function getLightBlueContrast($theme) {
360
- $light-blue-contrast-palette: map.get($light-blue, 'contrast');
361
- $light-blue-contrast: map.get($light-blue-contrast-palette, getShade($theme));
362
- @return $light-blue-contrast;
363
- }
364
-
365
- @function getLightBlueAlpha($theme) {
366
- $light-blue-color: getLightBlue($theme);
367
- $light-blue-color-alpha: rgba($light-blue-color, 0.1);
368
- @return $light-blue-color-alpha;
369
- }
370
-
371
- @function getLightBlueContrastAlpha($theme) {
372
- $light-blue-contrast: getLightBlueContrast($theme);
373
- $light-blue-contrast-alpha: rgba($light-blue-contrast, 0.1);
374
- @return $light-blue-contrast-alpha;
375
- }
376
-
377
- // Cyan
378
- @function getCyan($theme) {
379
- $cyan-color: map.get($cyan, getShade($theme));
380
- @return $cyan-color;
381
- }
382
-
383
- @function getCyanContrast($theme) {
384
- $cyan-contrast-palette: map.get($cyan, 'contrast');
385
- $cyan-contrast: map.get($cyan-contrast-palette, getShade($theme));
386
- @return $cyan-contrast;
387
- }
388
-
389
- @function getCyanAlpha($theme) {
390
- $cyan-color: getCyan($theme);
391
- $cyan-color-alpha: rgba($cyan-color, 0.1);
392
- @return $cyan-color-alpha;
393
- }
394
-
395
- @function getCyanContrastAlpha($theme) {
396
- $cyan-contrast: getCyanContrast($theme);
397
- $cyan-contrast-alpha: rgba($cyan-contrast, 0.1);
398
- @return $cyan-contrast-alpha;
399
- }
400
-
401
- // Teal
402
- @function getTeal($theme) {
403
- $teal-color: map.get($teal, getShade($theme));
404
- @return $teal-color;
405
- }
406
-
407
- @function getTealContrast($theme) {
408
- $teal-contrast-palette: map.get($teal, 'contrast');
409
- $teal-contrast: map.get($teal-contrast-palette, getShade($theme));
410
- @return $teal-contrast;
411
- }
412
-
413
- @function getTealAlpha($theme) {
414
- $teal-color: getTeal($theme);
415
- $teal-color-alpha: rgba($teal-color, 0.1);
416
- @return $teal-color-alpha;
417
- }
418
-
419
- @function getTealContrastAlpha($theme) {
420
- $teal-contrast: getTealContrast($theme);
421
- $teal-contrast-alpha: rgba($teal-contrast, 0.1);
422
- @return $teal-contrast-alpha;
423
- }
424
-
425
- // Green
426
- @function getGreen($theme) {
427
- $green-color: map.get($green, getShade($theme));
428
- @return $green-color;
429
- }
430
-
431
- @function getGreenContrast($theme) {
432
- $green-contrast-palette: map.get($green, 'contrast');
433
- $green-contrast: map.get($green-contrast-palette, getShade($theme));
434
- @return $green-contrast;
435
- }
436
-
437
- @function getGreenAlpha($theme) {
438
- $green-color: getGreen($theme);
439
- $green-color-alpha: rgba($green-color, 0.1);
440
- @return $green-color-alpha;
441
- }
442
-
443
- @function getGreenContrastAlpha($theme) {
444
- $green-contrast: getGreenContrast($theme);
445
- $green-contrast-alpha: rgba($green-contrast, 0.1);
446
- @return $green-contrast-alpha;
447
- }
448
-
449
- // Light Green
450
- @function getLightGreen($theme) {
451
- $light-green-color: map.get($light-green, getShade($theme));
452
- @return $light-green-color;
453
- }
454
-
455
- @function getLightGreenContrast($theme) {
456
- $light-green-contrast-palette: map.get($light-green, 'contrast');
457
- $light-green-contrast: map.get($light-green-contrast-palette, getShade($theme));
458
- @return $light-green-contrast;
459
- }
460
-
461
- @function getLightGreenAlpha($theme) {
462
- $light-green-color: getLightGreen($theme);
463
- $light-green-color-alpha: rgba($light-green-color, 0.1);
464
- @return $light-green-color-alpha;
465
- }
466
-
467
- @function getLightGreenContrastAlpha($theme) {
468
- $light-green-contrast: getLightGreenContrast($theme);
469
- $light-green-contrast-alpha: rgba($light-green-contrast, 0.1);
470
- @return $light-green-contrast-alpha;
471
- }
472
-
473
- // Lime
474
- @function getLime($theme) {
475
- $lime-color: map.get($lime, getShade($theme));
476
- @return $lime-color;
477
- }
478
-
479
- @function getLimeContrast($theme) {
480
- $lime-contrast-palette: map.get($lime, 'contrast');
481
- $lime-contrast: map.get($lime-contrast-palette, getShade($theme));
482
- @return $lime-contrast;
483
- }
484
-
485
- @function getLimeAlpha($theme) {
486
- $lime-color: getLime($theme);
487
- $lime-color-alpha: rgba($lime-color, 0.1);
488
- @return $lime-color-alpha;
489
- }
490
-
491
- @function getLimeContrastAlpha($theme) {
492
- $lime-contrast: getLimeContrast($theme);
493
- $lime-contrast-alpha: rgba($lime-contrast, 0.1);
494
- @return $lime-contrast-alpha;
495
- }
496
-
497
- // Yellow
498
- @function getYellow($theme) {
499
- $yellow-color: map.get($yellow, getShade($theme));
500
- @return $yellow-color;
501
- }
502
-
503
- @function getYellowContrast($theme) {
504
- $yellow-contrast-palette: map.get($yellow, 'contrast');
505
- $yellow-contrast: map.get($yellow-contrast-palette, getShade($theme));
506
- @return $yellow-contrast;
507
- }
508
-
509
- @function getYellowAlpha($theme) {
510
- $yellow-color: getYellow($theme);
511
- $yellow-color-alpha: rgba($yellow-color, 0.1);
512
- @return $yellow-color-alpha;
513
- }
514
-
515
- @function getYellowContrastAlpha($theme) {
516
- $yellow-contrast: getYellowContrast($theme);
517
- $yellow-contrast-alpha: rgba($yellow-contrast, 0.1);
518
- @return $yellow-contrast-alpha;
519
- }
520
-
521
- // Amber
522
- @function getAmber($theme) {
523
- $amber-color: map.get($amber, getShade($theme));
524
- @return $amber-color;
525
- }
526
-
527
- @function getAmberContrast($theme) {
528
- $amber-contrast-palette: map.get($amber, 'contrast');
529
- $amber-contrast: map.get($amber-contrast-palette, getShade($theme));
530
- @return $amber-contrast;
531
- }
532
-
533
- @function getAmberAlpha($theme) {
534
- $amber-color: getAmber($theme);
535
- $amber-color-alpha: rgba($amber-color, 0.1);
536
- @return $amber-color-alpha;
537
- }
538
-
539
- @function getAmberContrastAlpha($theme) {
540
- $amber-contrast: getAmberContrast($theme);
541
- $amber-contrast-alpha: rgba($amber-contrast, 0.1);
542
- @return $amber-contrast-alpha;
543
- }
544
-
545
- // Orange
546
- @function getOrange($theme) {
547
- $orange-color: map.get($orange, getShade($theme));
548
- @return $orange-color;
549
- }
550
-
551
- @function getOrangeContrast($theme) {
552
- $orange-contrast-palette: map.get($orange, 'contrast');
553
- $orange-contrast: map.get($orange-contrast-palette, getShade($theme));
554
- @return $orange-contrast;
555
- }
556
-
557
- @function getOrangeAlpha($theme) {
558
- $orange-color: getOrange($theme);
559
- $orange-color-alpha: rgba($orange-color, 0.1);
560
- @return $orange-color-alpha;
561
- }
562
-
563
- @function getOrangeContrastAlpha($theme) {
564
- $orange-contrast: getOrangeContrast($theme);
565
- $orange-contrast-alpha: rgba($orange-contrast, 0.1);
566
- @return $orange-contrast-alpha;
567
- }
568
-
569
- // Deep Orange
570
- @function getDeepOrange($theme) {
571
- $deep-orange-color: map.get($deep-orange, getShade($theme));
572
- @return $deep-orange-color;
573
- }
574
-
575
- @function getDeepOrangeContrast($theme) {
576
- $deep-orange-contrast-palette: map.get($deep-orange, 'contrast');
577
- $deep-orange-contrast: map.get($deep-orange-contrast-palette, getShade($theme));
578
- @return $deep-orange-contrast;
579
- }
580
-
581
- @function getDeepOrangeAlpha($theme) {
582
- $deep-orange-color: getDeepOrange($theme);
583
- $deep-orange-color-alpha: rgba($deep-orange-color, 0.1);
584
- @return $deep-orange-color-alpha;
585
- }
586
-
587
- @function getDeepOrangeContrastAlpha($theme) {
588
- $deep-orange-contrast: getDeepOrangeContrast($theme);
589
- $deep-orange-contrast-alpha: rgba($deep-orange-contrast, 0.1);
590
- @return $deep-orange-contrast-alpha;
591
- }
592
-
593
- // Brown
594
- @function getBrown($theme) {
595
- $brown-color: map.get($brown, getShade($theme));
596
- @return $brown-color;
597
- }
598
-
599
- @function getBrownContrast($theme) {
600
- $brown-contrast-palette: map.get($brown, 'contrast');
601
- $brown-contrast: map.get($brown-contrast-palette, getShade($theme));
602
- @return $brown-contrast;
603
- }
604
-
605
- @function getBrownAlpha($theme) {
606
- $brown-color: getBrown($theme);
607
- $brown-color-alpha: rgba($brown-color, 0.1);
608
- @return $brown-color-alpha;
609
- }
610
-
611
- @function getBrownContrastAlpha($theme) {
612
- $brown-contrast: getBrownContrast($theme);
613
- $brown-contrast-alpha: rgba($brown-contrast, 0.1);
614
- @return $brown-contrast-alpha;
615
- }
616
-
617
- // Grey
618
- @function getGrey($theme) {
619
- $grey-color: map.get($grey, getShade($theme));
620
- @return $grey-color;
621
- }
622
-
623
- @function getGreyContrast($theme) {
624
- $grey-contrast-palette: map.get($grey, 'contrast');
625
- $grey-contrast: map.get($grey-contrast-palette, getShade($theme));
626
- @return $grey-contrast;
627
- }
628
-
629
- @function getGreyAlpha($theme) {
630
- $grey-color: getGrey($theme);
631
- $grey-color-alpha: rgba($grey-color, 0.1);
632
- @return $grey-color-alpha;
633
- }
634
-
635
- @function getGreyContrastAlpha($theme) {
636
- $grey-contrast: getGreyContrast($theme);
637
- $grey-contrast-alpha: rgba($grey-contrast, 0.1);
638
- @return $grey-contrast-alpha;
639
- }
640
-
641
- // Blue Grey
642
- @function getBlueGrey($theme) {
643
- $blue-grey-color: map.get($blue-grey, getShade($theme));
644
- @return $blue-grey-color;
645
- }
646
-
647
- @function getBlueGreyContrast($theme) {
648
- $blue-grey-contrast-palette: map.get($blue-grey, 'contrast');
649
- $blue-grey-contrast: map.get($blue-grey-contrast-palette, getShade($theme));
650
- @return $blue-grey-contrast;
651
- }
652
-
653
- @function getBlueGreyAlpha($theme) {
654
- $blue-grey-color: getBlueGrey($theme);
655
- $blue-grey-color-alpha: rgba($blue-grey-color, 0.1);
656
- @return $blue-grey-color-alpha;
657
- }
658
-
659
- @function getBlueGreyContrastAlpha($theme) {
660
- $blue-grey-contrast: getBlueGreyContrast($theme);
661
- $blue-grey-contrast-alpha: rgba($blue-grey-contrast, 0.1);
662
- @return $blue-grey-contrast-alpha;
663
- }
664
-
665
- // Primary
666
- @function getPrimary($theme) {
667
- $primary: map.get($theme, primary);
668
- $primary-color: map.get($primary, default);
669
- @return $primary-color;
670
- }
671
-
672
- @function getPrimaryContrast($theme) {
673
- $primary: map.get($theme, primary);
674
- $primary-contrast: map.get($primary, default-contrast);
675
- @return $primary-contrast;
676
- }
677
-
678
- @function getPrimaryAlpha($theme) {
679
- $primary-color: getPrimary($theme);
680
- $primary-color-alpha: rgba($primary-color, 0.1);
681
- @return $primary-color-alpha;
682
- }
683
-
684
- @function getPrimaryContrastAlpha($theme) {
685
- $primary-contrast: getPrimaryContrast($theme);
686
- $primary-contrast-alpha: rgba($primary-contrast, 0.1);
687
- @return $primary-contrast-alpha;
688
- }
689
-
690
- // Accent
691
- @function getAccent($theme) {
692
- $accent: map.get($theme, accent);
693
- $accent-color: map.get($accent, default);
694
- @return $accent-color;
695
- }
696
-
697
- @function getAccentContrast($theme) {
698
- $accent: map.get($theme, accent);
699
- $accent-contrast: map.get($accent, default-contrast);
700
- @return $accent-contrast;
701
- }
702
-
703
- @function getAccentAlpha($theme) {
704
- $accent-color: getAccent($theme);
705
- $accent-color-alpha: rgba($accent-color, 0.1);
706
- @return $accent-color-alpha;
707
- }
708
-
709
- @function getAccentContrastAlpha($theme) {
710
- $accent-contrast: getAccentContrast($theme);
711
- $accent-contrast-alpha: rgba($accent-contrast, 0.1);
712
- @return $accent-contrast-alpha;
713
- }
714
-
715
- // Danger
716
- @function getDanger($theme) {
717
- $danger: map.get($theme, danger);
718
- $danger-color: map.get($danger, default);
719
- @return $danger-color;
720
- }
721
-
722
- @function getDangerContrast($theme) {
723
- $danger: map.get($theme, danger);
724
- $danger-contrast: map.get($danger, default-contrast);
725
- @return $danger-contrast;
726
- }
727
-
728
- @function getDangerAlpha($theme) {
729
- $danger-color: getDanger($theme);
730
- $danger-color-alpha: rgba($danger-color, 0.1);
731
- @return $danger-color-alpha;
732
- }
733
-
734
- @function getDangerContrastAlpha($theme) {
735
- $danger-contrast: getDangerContrast($theme);
736
- $danger-contrast-alpha: rgba($danger-contrast, 0.1);
737
- @return $danger-contrast-alpha;
738
- }
739
-
740
- // Warn
741
- @function getWarn($theme) {
742
- $warn: map.get($theme, warn);
743
- $warn-color: map.get($warn, default);
744
- @return $warn-color;
745
- }
746
-
747
- @function getWarnContrast($theme) {
748
- $warn: map.get($theme, warn);
749
- $warn-contrast: map.get($warn, default-contrast);
750
- @return $warn-contrast;
751
- }
752
-
753
- @function getWarnAlpha($theme) {
754
- $warn-color: getWarn($theme);
755
- $warn-color-alpha: rgba($warn-color, 0.1);
756
- @return $warn-color-alpha;
757
- }
758
-
759
- @function getWarnContrastAlpha($theme) {
760
- $warn-contrast: getWarnContrast($theme);
761
- $warn-contrast-alpha: rgba($warn-contrast, 0.1);
762
- @return $warn-contrast-alpha;
763
- }
764
-
765
- // Success
766
- @function getSuccess($theme) {
767
- $success: map.get($theme, success);
768
- $success-color: map.get($success, default);
769
- @return $success-color;
770
- }
771
-
772
- @function getSuccessContrast($theme) {
773
- $success: map.get($theme, success);
774
- $success-contrast: map.get($success, default-contrast);
775
- @return $success-contrast;
776
- }
777
-
778
- @function getSuccessAlpha($theme) {
779
- $success-color: getSuccess($theme);
780
- $success-color-alpha: rgba($success-color, 0.1);
781
- @return $success-color-alpha;
782
- }
783
-
784
- @function getSuccessContrastAlpha($theme) {
785
- $success-contrast: getSuccessContrast($theme);
786
- $success-contrast-alpha: rgba($success-contrast, 0.1);
787
- @return $success-contrast-alpha;
788
- }
789
-
790
- // Info
791
- @function getInfo($theme) {
792
- $info: map.get($theme, info);
793
- $info-color: map.get($info, default);
794
- @return $info-color;
795
- }
796
-
797
- @function getInfoContrast($theme) {
798
- $info: map.get($theme, info);
799
- $info-contrast: map.get($info, default-contrast);
800
- @return $info-contrast;
801
- }
802
-
803
- @function getInfoAlpha($theme) {
804
- $info-color: getInfo($theme);
805
- $info-color-alpha: rgba($info-color, 0.1);
806
- @return $info-color-alpha;
807
- }
808
-
809
- @function getInfoContrastAlpha($theme) {
810
- $info-contrast: getInfoContrast($theme);
811
- $info-contrast-alpha: rgba($info-contrast, 0.1);
812
- @return $info-contrast-alpha;
813
- }
814
-
815
-
816
- // Gets a color from a theme palette (the output of mat-palette).
817
- // The hue can be one of the standard values (500, A400, etc.), one of the three preconfigured
818
- // hues (default, lighter, darker), or any of the aforementioned prefixed with "-contrast".
819
- //
820
- // @param $color-map The theme palette (output of mat-palette).
821
- // @param $hue The hue from the palette to use. If this is a value between 0 and 1, it will
822
- // be treated as opacity.
823
- // @param $opacity The alpha channel value for the color.
824
- @function map-color($palette, $hue: default, $opacity: null) {
825
-
826
- // If hueKey is a number between zero and one, then it actually contains an
827
- // opacity value, so recall this function with the default hue and that given opacity.
828
- @if type-of($hue)==number and $hue >=0 and $hue <=1 {
829
- @return map-color($palette, default, $hue);
830
- }
831
-
832
- $color: map.get($palette, $hue);
833
-
834
- @if (type-of($color) !=color) {
835
- // If the $color resolved to something different from a color (e.g. a CSS variable),
836
- // we can't apply the opacity anyway so we return the value as is, otherwise Sass can
837
- // throw an error or output something invalid.
838
- @return $color;
839
- }
840
-
841
- @return rgba($color, if($opacity ==null, opacity($color), $opacity));
842
- }
843
-
844
- // Creates a container object for a light theme to be given to individual component theme mixins.
845
- @function light-theme($primary,
846
- $accent,
847
- $warn: palette($yellow, 600),
848
- $danger: palette($red, A700),
849
- $success: palette($green, 900),
850
- $info: palette($blue, A700)) {
851
- @return (primary: $primary,
852
- accent: $accent,
853
- warn: $warn,
854
- danger: $danger,
855
- success: $success,
856
- info: $info,
857
- is-dark: false,
858
- foreground: $light-theme-foreground-palette,
859
- background: $light-theme-background-palette );
860
- }
861
-
862
- // Creates a container object for a dark theme to be given to individual component theme mixins.
863
- @function dark-theme($primary, $accent, $warn: palette($yellow, 200),
864
- $danger: palette($red, 200),
865
- $success: palette($green, A200),
866
- $info: palette($blue, 800)) {
867
- @return (primary: $primary,
868
- accent: $accent,
869
- warn: $warn,
870
- danger: $danger,
871
- success: $success,
872
- info: $info,
873
- is-dark: true,
874
- foreground: $dark-theme-foreground-palette,
875
- background: $dark-theme-background-palette );
876
- }
877
-
878
- // Creates a container object for a custom light theme to be given to individual component theme mixins.
879
- @function light-custom-theme($custom-light-fg,
880
- $custom-light-bg,
881
- $primary,
882
- $accent,
883
- $warn: palette($yellow, 600),
884
- $danger: palette($red, A700),
885
- $success: palette($green, 900),
886
- $info: palette($blue, 900)) {
887
- @return (primary: $primary,
888
- accent: $accent,
889
- warn: $warn,
890
- danger: $danger,
891
- success: $success,
892
- info: $info,
893
- is-dark: false,
894
- foreground: $custom-light-fg,
895
- background: $custom-light-bg );
896
- }
897
-
898
- // Creates a container object for a custom dark theme to be given to individual component theme mixins.
899
- @function dark-custom-theme($custom-dark-fg,
900
- $custom-dark-bg,
901
- $primary,
902
- $accent,
903
- $warn: palette($yellow, 200),
904
- $danger: palette($red, 200),
905
- $success: palette($green, 200),
906
- $info: palette($blue, 200)) {
907
- @return (primary: $primary,
908
- accent: $accent,
909
- warn: $warn,
910
- danger: $danger,
911
- success: $success,
912
- info: $info,
913
- is-dark: true,
914
- foreground: $custom-dark-fg,
915
- background: $custom-dark-bg );
916
- }
7
+ // palette() / map-color() / map-contrast() / light-theme() / dark-theme() /
8
+ // light-custom-theme() / dark-custom-theme() foram removidas. Construíam o mapa $theme
9
+ // (cores compile-time a partir das paletas Material) consumido por matcha-components().
10
+ // A API nova é color-runtime: o tema é só o conjunto de --matcha-color-* (synced do Figma),
11
+ // emitido por matcha-css-custom-properties($is-dark). Whitelabel = matcha-define-theme()
12
+ // (override de --matcha-color-*). Ver src/app/app.theme.scss + main.scss (nota do shim).
13
+ // Os mapas crus de paleta ($red/$blue/... em tokens/_material-palette) FICAM — alimentam
14
+ // os tokens runtime --matcha-color-{nome} (ver tokens/_emit-tokens).
917
15
 
918
16
  // -------------------------------------------------------------------------------------------------------------------
919
17
  // @ Typography functions