Skip to content

Commit be48108

Browse files
andrewseguinAndrew Seguin
and
Andrew Seguin
authored
fix(material/chips): update tokens to system colors (#31280)
* fix(material/chips): update tokens to system colors * fix(material/chips): fix lint --------- Co-authored-by: Andrew Seguin <[email protected]>
1 parent c5b2f0a commit be48108

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

src/material/chips/_m2-chip.scss

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
@use 'sass:map';
2-
@use 'sass:meta';
3-
@use 'sass:color';
42
@use '../core/theming/inspection';
5-
@use '../core/m2/palette' as m2-palette;
63
@use '../core/theming/theming';
74
@use '../core/tokens/m2-utils';
85
@use '../core/tokens/m3-utils';
@@ -40,38 +37,24 @@
4037
// Tokens that can be configured through Angular Material's color theming API.
4138
@function get-color-tokens($theme, $color-variant: null) {
4239
$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);
4642

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 {
6144
$system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
62-
6345
$background: map.get($system, primary);
6446
$foreground: map.get($system, on-primary);
6547
}
48+
6649
@return (
6750
chip-disabled-label-text-color: $foreground,
6851
chip-elevated-container-color: $background,
6952
chip-elevated-disabled-container-color: $background,
7053
chip-elevated-selected-container-color: $background,
7154
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),
7356
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),
7558
chip-label-text-color: $foreground,
7659
chip-selected-disabled-trailing-icon-color: $foreground,
7760
chip-selected-focus-state-layer-color: map.get($system, focus-state-layer-opacity),

0 commit comments

Comments
 (0)