|
1 | 1 | @use 'sass:map';
|
2 |
| -@use 'sass:meta'; |
3 |
| -@use 'sass:color'; |
4 | 2 | @use '../core/theming/inspection';
|
5 |
| -@use '../core/m2/palette' as m2-palette; |
6 | 3 | @use '../core/theming/theming';
|
7 | 4 | @use '../core/tokens/m2-utils';
|
8 | 5 | @use '../core/tokens/m3-utils';
|
|
40 | 37 | // Tokens that can be configured through Angular Material's color theming API.
|
41 | 38 | @function get-color-tokens($theme, $color-variant: null) {
|
42 | 39 | $system: m2-utils.get-system($theme);
|
43 |
| - $foreground: null; |
44 |
| - $background: null; |
45 |
| - $state-layer-color: inspection.get-theme-color($theme, foreground, base); |
| 40 | + $background: m3-utils.color-with-opacity(map.get($system, on-surface), 12%); |
| 41 | + $foreground: map.get($system, on-surface); |
46 | 42 |
|
47 |
| - @if $color-variant == null { |
48 |
| - $is-dark: inspection.get-theme-type($theme) == dark; |
49 |
| - $grey-50: map.get(m2-palette.$grey-palette, 50); |
50 |
| - $grey-900: map.get(m2-palette.$grey-palette, 900); |
51 |
| - $foreground: if($is-dark, $grey-50, $grey-900); |
52 |
| - |
53 |
| - $surface: map.get($system, surface); |
54 |
| - $background: if( |
55 |
| - meta.type-of($state-layer-color) == color and meta.type-of($surface) == color, |
56 |
| - color.mix($state-layer-color, $surface, 12%), |
57 |
| - $state-layer-color |
58 |
| - ); |
59 |
| - } |
60 |
| - @else { |
| 43 | + @if $color-variant { |
61 | 44 | $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
|
62 |
| - |
63 | 45 | $background: map.get($system, primary);
|
64 | 46 | $foreground: map.get($system, on-primary);
|
65 | 47 | }
|
| 48 | + |
66 | 49 | @return (
|
67 | 50 | chip-disabled-label-text-color: $foreground,
|
68 | 51 | chip-elevated-container-color: $background,
|
69 | 52 | chip-elevated-disabled-container-color: $background,
|
70 | 53 | chip-elevated-selected-container-color: $background,
|
71 | 54 | chip-flat-disabled-selected-container-color: $background,
|
72 |
| - chip-focus-state-layer-color: $state-layer-color, |
| 55 | + chip-focus-state-layer-color: map.get($system, on-surface), |
73 | 56 | chip-focus-state-layer-opacity: map.get($system, focus-state-layer-opacity),
|
74 |
| - chip-hover-state-layer-color: $state-layer-color, |
| 57 | + chip-hover-state-layer-color: map.get($system, on-surface), |
75 | 58 | chip-label-text-color: $foreground,
|
76 | 59 | chip-selected-disabled-trailing-icon-color: $foreground,
|
77 | 60 | chip-selected-focus-state-layer-color: map.get($system, focus-state-layer-opacity),
|
|
0 commit comments