|
11 | 11 | // Generates all color mapping for the properties that only change based on the theme.
|
12 | 12 | @function _get-theme-base-map($is-dark) {
|
13 | 13 | $on-surface: if($is-dark, mdc-color-palette.$grey-100, mdc-color-palette.$grey-800);
|
14 |
| - $hairline: if($is-dark, mdc-color-palette.$grey-500, mdc-color-palette.$grey-300); |
15 |
| - $on-surface-variant: if($is-dark, mdc-color-palette.$grey-200, mdc-color-palette.$grey-700); |
| 14 | + $hairline: if($is-dark, mdc-color-palette.$grey-700, mdc-color-palette.$grey-300); |
| 15 | + $on-surface-variant: if($is-dark, mdc-color-palette.$grey-500, mdc-color-palette.$grey-700); |
16 | 16 | $on-surface-state-content: if($is-dark, mdc-color-palette.$grey-50, mdc-color-palette.$grey-900);
|
17 |
| - $disabled-handle-color: mdc-color-palette.$grey-800; |
18 |
| - $selected-icon-color: mdc-color-palette.$grey-100; |
19 |
| - $icon-color: if($is-dark, mdc-color-palette.$grey-800, mdc-color-palette.$grey-100); |
| 17 | + $disabled-handle-color: if($is-dark, #000, mdc-color-palette.$grey-800); |
| 18 | + $icon-color: if($is-dark, mdc-color-palette.$grey-900, #fff); |
20 | 19 |
|
21 | 20 | @return (
|
22 | 21 | disabled-selected-handle-color: $disabled-handle-color,
|
|
40 | 39 | handle-surface-color: surface,
|
41 | 40 | unselected-handle-color: $on-surface-variant,
|
42 | 41 |
|
43 |
| - selected-icon-color: $selected-icon-color, |
| 42 | + selected-icon-color: $icon-color, |
44 | 43 | disabled-selected-icon-color: $icon-color,
|
45 | 44 | disabled-unselected-icon-color: $icon-color,
|
46 | 45 | unselected-icon-color: $icon-color,
|
47 | 46 | );
|
48 | 47 | }
|
49 | 48 |
|
50 | 49 | // Generates the mapping for the properties that change based on the slide toggle color.
|
51 |
| -@function _get-theme-color-map($color-palette) { |
52 |
| - $state-content: color.scale($color-palette, $blackness: 50%); |
53 |
| - $inverse: color.scale($color-palette, $lightness: 75%); |
| 50 | +@function _get-theme-color-map($color-palette, $is-dark) { |
| 51 | + $primary: theming.get-color-from-palette($color-palette, if($is-dark, 300, 600)); |
| 52 | + $state-content: theming.get-color-from-palette($color-palette, if($is-dark, 200, 900)); |
| 53 | + $inverse: theming.get-color-from-palette($color-palette, if($is-dark, 600, 300)); |
54 | 54 |
|
55 | 55 | @return (
|
56 |
| - selected-focus-state-layer-color: $color-palette, |
57 |
| - selected-handle-color: $color-palette, |
58 |
| - selected-hover-state-layer-color: $color-palette, |
59 |
| - selected-pressed-state-layer-color: $color-palette, |
| 56 | + selected-focus-state-layer-color: $primary, |
| 57 | + selected-handle-color: $primary, |
| 58 | + selected-hover-state-layer-color: $primary, |
| 59 | + selected-pressed-state-layer-color: $primary, |
60 | 60 |
|
61 | 61 | selected-focus-handle-color: $state-content,
|
62 | 62 | selected-hover-handle-color: $state-content,
|
|
71 | 71 |
|
72 | 72 | @mixin color($config-or-theme) {
|
73 | 73 | $config: theming.get-color-config($config-or-theme);
|
74 |
| - $primary: theming.get-color-from-palette(map.get($config, primary)); |
75 |
| - $accent: theming.get-color-from-palette(map.get($config, accent)); |
76 |
| - $warn: theming.get-color-from-palette(map.get($config, warn)); |
| 74 | + $primary: map.get($config, primary); |
| 75 | + $accent: map.get($config, accent); |
| 76 | + $warn: map.get($config, warn); |
77 | 77 | $is-dark: map.get($config, is-dark);
|
78 | 78 | $foreground: map.get($config, foreground);
|
79 | 79 |
|
|
90 | 90 | }
|
91 | 91 |
|
92 | 92 | &.mat-primary {
|
93 |
| - @include mdc-switch-theme.theme(_get-theme-color-map($primary)); |
| 93 | + @include mdc-switch-theme.theme(_get-theme-color-map($primary, $is-dark)); |
94 | 94 | }
|
95 | 95 |
|
96 | 96 | &.mat-accent {
|
97 |
| - @include mdc-switch-theme.theme(_get-theme-color-map($accent)); |
| 97 | + @include mdc-switch-theme.theme(_get-theme-color-map($accent, $is-dark)); |
98 | 98 | }
|
99 | 99 |
|
100 | 100 | &.mat-warn {
|
101 |
| - @include mdc-switch-theme.theme(_get-theme-color-map($warn)); |
| 101 | + @include mdc-switch-theme.theme(_get-theme-color-map($warn, $is-dark)); |
102 | 102 | }
|
103 | 103 | }
|
104 | 104 | }
|
|
0 commit comments