Skip to content

Commit 04d8e02

Browse files
authored
refactor: switch m2 surface colors to system terms (#31175)
1 parent 734c2ec commit 04d8e02

File tree

31 files changed

+63
-55
lines changed

31 files changed

+63
-55
lines changed

src/material-experimental/popover-edit/_popover-edit-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
}
77

88
@mixin color($theme) {
9-
$background-color: mat.get-theme-color($theme, background, 'card');
9+
$background-color: mat.get-theme-color($theme, system, surface);
1010

1111
// TODO: these structural styles don't belong in the `color` part of a theme.
1212
// We should figure out a better place for them.

src/material/autocomplete/_m2-autocomplete.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Tokens that can be configured through Angular Material's color theming API.
1414
@function get-color-tokens($theme) {
1515
@return (
16-
autocomplete-background-color: inspection.get-theme-color($theme, background, card)
16+
autocomplete-background-color: inspection.get-theme-color($theme, system, surface)
1717
);
1818
}
1919

src/material/bottom-sheet/_m2-bottom-sheet.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// Tokens that can be configured through Angular Material's color theming API.
1313
@function get-color-tokens($theme) {
1414
@return (
15-
bottom-sheet-container-text-color: inspection.get-theme-color($theme, foreground, text),
16-
bottom-sheet-container-background-color: inspection.get-theme-color($theme, background, dialog),
15+
bottom-sheet-container-text-color: inspection.get-theme-color($theme, system, on-surface),
16+
bottom-sheet-container-background-color: inspection.get-theme-color($theme, system, surface),
1717
);
1818
}
1919

src/material/button-toggle/_m2-button-toggle.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@
2828
$divider-color: if(
2929
meta.type-of($theme-divider-color) == color,
3030
theming.private-rgba-to-hex(
31-
$theme-divider-color, inspection.get-theme-color($theme, background, card)),
31+
$theme-divider-color, inspection.get-theme-color($theme, system, surface)),
3232
$theme-divider-color);
3333

3434
@return (
35-
button-toggle-background-color: inspection.get-theme-color($theme, background, card),
35+
button-toggle-background-color: inspection.get-theme-color($theme, system, surface),
3636
button-toggle-disabled-selected-state-background-color:
3737
inspection.get-theme-color($theme, background, selected-disabled-button),
3838
button-toggle-disabled-selected-state-text-color:
39-
inspection.get-theme-color($theme, foreground, text),
39+
inspection.get-theme-color($theme, system, on-surface),
4040
button-toggle-disabled-state-background-color:
41-
inspection.get-theme-color($theme, background, card),
41+
inspection.get-theme-color($theme, system, surface),
4242
button-toggle-disabled-state-text-color:
4343
inspection.get-theme-color($theme, foreground, disabled-button),
4444
button-toggle-divider-color: $divider-color,
@@ -57,10 +57,10 @@
5757
button-toggle-legacy-text-color: inspection.get-theme-color($theme, foreground, hint-text),
5858
button-toggle-selected-state-background-color:
5959
inspection.get-theme-color($theme, background, selected-button),
60-
button-toggle-selected-state-text-color: inspection.get-theme-color($theme, foreground, text),
60+
button-toggle-selected-state-text-color: inspection.get-theme-color($theme, system, on-surface),
6161
button-toggle-state-layer-color: sass-utils.safe-color-change(
6262
inspection.get-theme-color($theme, background, focused-button), $alpha: 1),
63-
button-toggle-text-color: inspection.get-theme-color($theme, foreground, text),
63+
button-toggle-text-color: inspection.get-theme-color($theme, system, on-surface),
6464
);
6565
}
6666

src/material/button/_m2-button.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
);
5353

5454
@return (
55-
button-filled-container-color: inspection.get-theme-color($theme, background, card),
55+
button-filled-container-color: inspection.get-theme-color($theme, system, surface),
5656
button-filled-disabled-container-color:
5757
inspection.get-theme-color($theme, foreground, disabled-button, 0.12),
5858
button-filled-disabled-label-text-color:
@@ -76,7 +76,7 @@
7676
button-outlined-pressed-state-layer-opacity: if($is-dark, 0.24, 0.12),
7777
button-outlined-ripple-color: inspection.get-theme-color($theme, foreground, base, 0.1),
7878
button-outlined-state-layer-color: inspection.get-theme-color($theme, foreground, base),
79-
button-protected-container-color: inspection.get-theme-color($theme, background, card),
79+
button-protected-container-color: inspection.get-theme-color($theme, system, surface),
8080
button-protected-disabled-container-color:
8181
inspection.get-theme-color($theme, foreground, disabled-button, 0.12),
8282
button-protected-disabled-label-text-color:
@@ -98,7 +98,7 @@
9898
button-text-pressed-state-layer-opacity: if($is-dark, 0.24, 0.12),
9999
button-text-ripple-color: inspection.get-theme-color($theme, foreground, base, 0.1),
100100
button-text-state-layer-color: inspection.get-theme-color($theme, foreground, base),
101-
button-tonal-container-color: inspection.get-theme-color($theme, background, card),
101+
button-tonal-container-color: inspection.get-theme-color($theme, system, surface),
102102
button-tonal-disabled-container-color:
103103
inspection.get-theme-color($theme, foreground, disabled-button, 0.12),
104104
button-tonal-disabled-label-text-color:

src/material/button/_m2-fab.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
$is-dark: inspection.get-theme-type($theme) == dark;
3333

3434
@return (
35-
fab-container-color: inspection.get-theme-color($theme, background, card),
35+
fab-container-color: inspection.get-theme-color($theme, system, surface),
3636
fab-disabled-state-container-color:
3737
inspection.get-theme-color($theme, background, disabled-button, 0.12),
3838
fab-disabled-state-foreground-color:
@@ -43,7 +43,7 @@
4343
fab-hover-state-layer-opacity: if($is-dark, 0.08, 0.04),
4444
fab-pressed-state-layer-opacity: if($is-dark, 0.24, 0.12),
4545
fab-ripple-color: inspection.get-theme-color($theme, foreground, base, 0.1),
46-
fab-small-container-color: inspection.get-theme-color($theme, background, card),
46+
fab-small-container-color: inspection.get-theme-color($theme, system, surface),
4747
fab-small-disabled-state-container-color:
4848
inspection.get-theme-color($theme, background, disabled-button, 0.12),
4949
fab-small-disabled-state-foreground-color:

src/material/card/_m2-card.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
// Tokens that can be configured through Angular Material's color theming API.
1616
@function get-color-tokens($theme) {
1717
@return (
18-
card-elevated-container-color: inspection.get-theme-color($theme, background, card),
18+
card-elevated-container-color: inspection.get-theme-color($theme, system, surface),
1919
card-elevated-container-elevation: elevation.get-box-shadow(1),
20-
card-outlined-container-color: inspection.get-theme-color($theme, background, card),
20+
card-outlined-container-color: inspection.get-theme-color($theme, system, surface),
2121
card-outlined-container-elevation: elevation.get-box-shadow(0),
2222
card-outlined-outline-color: rgba(inspection.get-theme-color($theme, foreground, base), 0.12),
2323
card-subtitle-text-color: inspection.get-theme-color($theme, foreground, secondary-text),
24-
card-filled-container-color: inspection.get-theme-color($theme, background, card),
24+
card-filled-container-color: inspection.get-theme-color($theme, system, surface),
2525
card-filled-container-elevation: elevation.get-box-shadow(0)
2626
);
2727
}

src/material/checkbox/_m2-checkbox.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
$tokens: (
4949
checkbox-disabled-label-color: inspection.get-theme-color($theme, foreground, disabled-text),
50-
checkbox-label-text-color: inspection.get-theme-color($theme, foreground, text),
50+
checkbox-label-text-color: inspection.get-theme-color($theme, system, on-surface),
5151
checkbox-disabled-selected-icon-color: $disabled-color,
5252
checkbox-disabled-unselected-icon-color: $disabled-color,
5353
checkbox-selected-checkmark-color: $selected-checkmark-color,

src/material/chips/_m2-chip.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@
3939
$background: null;
4040
$state-layer-color: inspection.get-theme-color($theme, foreground, base);
4141
$state-layer-opacity: 0.12; // 0.12 is a common value in Material Design for opacity.
42-
$surface: inspection.get-theme-color($theme, background, card);
42+
$surface: inspection.get-theme-color($theme, system, surface);
4343

4444
@if $palette-name == null {
4545
$is-dark: inspection.get-theme-type($theme) == dark;
4646
$grey-50: map.get(m2-palette.$grey-palette, 50);
4747
$grey-900: map.get(m2-palette.$grey-palette, 900);
4848
$foreground: if($is-dark, $grey-50, $grey-900);
4949

50-
$surface: inspection.get-theme-color($theme, background, card);
50+
$surface: inspection.get-theme-color($theme, system, surface);
5151
$background: if(
5252
meta.type-of($state-layer-color) == color and meta.type-of($surface) == color,
5353
color.mix($state-layer-color, $surface, 12%),

src/material/core/_m2-app.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@function get-color-tokens($theme) {
1313
$tokens: (
1414
app-background-color: inspection.get-theme-color($theme, background, background),
15-
app-text-color: inspection.get-theme-color($theme, foreground, text),
15+
app-text-color: inspection.get-theme-color($theme, system, on-surface),
1616
);
1717

1818
@for $zValue from 0 through 24 {

0 commit comments

Comments
 (0)