|
4 | 4 | @use "@angular/material" as mat;
|
5 | 5 |
|
6 | 6 | @mixin color($theme) {
|
7 |
| - // Get the color config from the theme. |
8 |
| - $color-config: mat.get-color-config($theme); |
9 |
| - |
10 |
| - // Get the primary color palette from the color-config. |
11 |
| - $primary-palette: map.get($color-config, "primary"); |
12 |
| - $is-dark-theme: map.get($theme, is-dark); |
13 |
| - $exportBackgroundOpacity: if($is-dark-theme, 0.12, 0.06); |
14 |
| - |
15 | 7 | .alert {
|
16 |
| - color: mat.get-color-from-palette($primary-palette, if($is-dark-theme, 50, default)); |
17 |
| - background: mat.get-color-from-palette( |
18 |
| - $primary-palette, |
19 |
| - 300, |
20 |
| - $exportBackgroundOpacity |
21 |
| - ); |
22 |
| - border-color: mat.get-color-from-palette($primary-palette, 100); |
| 8 | + color: mat.get-theme-color($theme, on-primary-container); |
| 9 | + background: mat.get-theme-color($theme, primary-container); |
| 10 | + border-color: mat.get-theme-color($theme, primary); |
23 | 11 |
|
24 | 12 | .alert-link {
|
25 |
| - color: mat.get-color-from-palette($primary-palette, if($is-dark-theme, 200, 500)); |
| 13 | + color: mat.get-theme-color($theme, on-primary-container); |
26 | 14 | }
|
27 | 15 | }
|
28 | 16 | }
|
29 | 17 |
|
30 |
| -@mixin typography($typography-config) { |
| 18 | +@mixin typography($theme) { |
31 | 19 | .alert {
|
32 |
| - font-family: mat.font-family($typography-config); |
| 20 | + font: mat.get-theme-typography($theme, "body-medium", "font"); |
| 21 | + letter-spacing: mat.get-theme-typography( |
| 22 | + $theme, |
| 23 | + "body-medium", |
| 24 | + "letter-spacing" |
| 25 | + ); |
33 | 26 |
|
34 | 27 | .alert-heading {
|
35 |
| - @include mat.typography-level($typography-config, "headline-6"); |
| 28 | + font: mat.get-theme-typography($theme, "headline-small", "font"); |
| 29 | + letter-spacing: mat.get-theme-typography( |
| 30 | + $theme, |
| 31 | + "headline-small", |
| 32 | + "letter-spacing" |
| 33 | + ); |
36 | 34 | }
|
37 | 35 | .alert-footer {
|
38 |
| - @include mat.typography-level($typography-config, "caption"); |
| 36 | + font: mat.get-theme-typography($theme, "label-small", "font"); |
| 37 | + letter-spacing: mat.get-theme-typography( |
| 38 | + $theme, |
| 39 | + "label-small", |
| 40 | + "letter-spacing" |
| 41 | + ); |
39 | 42 | }
|
40 | 43 | }
|
41 | 44 | }
|
42 | 45 |
|
43 | 46 | @mixin theme($theme) {
|
44 |
| - $color-config: mat.get-color-config($theme); |
45 |
| - @if $color-config != null { |
46 |
| - @include color($theme); |
47 |
| - } |
48 |
| - |
49 |
| - $typography-config: mat.get-typography-config($theme); |
50 |
| - @if $typography-config != null { |
51 |
| - @include typography($typography-config); |
52 |
| - } |
| 47 | + @include color($theme); |
| 48 | + @include typography($theme); |
53 | 49 | }
|
0 commit comments