Skip to content

Commit

Permalink
fix(material/chips): derive surface color from palette
Browse files Browse the repository at this point in the history
Fixes a hardcoded color in the chips tokens.
  • Loading branch information
crisbeto committed Mar 4, 2024
1 parent 3d4b793 commit 54b6731
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/material/core/tokens/m2/mdc/_chip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@use 'sass:map';
@use 'sass:meta';
@use '../../token-utils';
@use '../../../mdc-helpers/mdc-helpers';
@use '../../../style/sass-utils';
@use '../../../theming/theming';
@use '../../../theming/inspection';
Expand Down Expand Up @@ -230,15 +229,10 @@ $prefix: (mdc, chip);
$foreground: if($is-dark, $grey-50, $grey-900);

$surface: inspection.get-theme-color($theme, background, card);
$on-surface: if(
mdc-helpers.variable-safe-contrast-tone($surface, $is-dark) == 'dark',
#000,
#fff
);
$background: if(
meta.type-of($on-surface) == color and meta.type-of($surface) == color,
color.mix($on-surface, $surface, 12%),
$on-surface
meta.type-of($state-layer-color) == color and meta.type-of($surface) == color,
color.mix($state-layer-color, $surface, 12%),
$state-layer-color
);
}
@else {
Expand Down

0 comments on commit 54b6731

Please sign in to comment.