Skip to content

Commit ee12bf5

Browse files
authored
refactor: use system background (#31232)
# Conflicts: # src/material/badge/_m2-badge.scss
1 parent 68d7ea0 commit ee12bf5

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

src/material/core/_m2-app.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@use 'sass:map';
22
@use './theming/inspection';
33
@use './style/elevation';
4+
@use '../core/tokens/m2-utils';
45

56
// Tokens that can't be configured through Angular Material's current theming API,
67
// but may be in a future version of the theming API.
@@ -10,9 +11,11 @@
1011

1112
// Tokens that can be configured through Angular Material's color theming API.
1213
@function get-color-tokens($theme) {
14+
$system: m2-utils.get-system($theme);
15+
1316
$tokens: (
14-
app-background-color: inspection.get-theme-color($theme, background, background),
15-
app-text-color: inspection.get-theme-color($theme, system, on-surface),
17+
app-background-color: map.get($system, background),
18+
app-text-color: map.get($system, on-surface),
1619
);
1720

1821
@for $zValue from 0 through 24 {

src/material/core/m2/_theming.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
system: (
127127
surface: white,
128128
on-surface: rgba(black, 0.87),
129+
background: map.get(palette.$grey-palette, 50),
129130
outline: rgba(black, 0.12),
130131
hover-state-layer-opacity: 0.04,
131132
focus-state-layer-opacity: 0.12,
@@ -147,6 +148,7 @@
147148
system: (
148149
surface: map.get(palette.$grey-palette, 800),
149150
on-surface: white,
151+
background: #303030,
150152
outline: rgba(white, 0.12),
151153
hover-state-layer-opacity: 0.04,
152154
focus-state-layer-opacity: 0.12,

src/material/core/selection/pseudo-checkbox/_m2-pseudo-checkbox.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@function get-color-tokens($theme, $palette-name: accent) {
1111
$is-dark: inspection.get-theme-type($theme) == dark;
1212
$disabled-color: if($is-dark, #686868, #b0b0b0);
13-
$checkmark-color: inspection.get-theme-color($theme, background, background);
13+
$checkmark-color: inspection.get-theme-color($theme, system, background);
1414

1515
@return (
1616
pseudo-checkbox-full-selected-icon-color: inspection.get-theme-color($theme, $palette-name),

src/material/sidenav/_m2-sidenav.scss

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
@use 'sass:color';
2+
@use 'sass:map';
23
@use 'sass:meta';
34
@use '../core/theming/inspection';
45
@use '../core/style/elevation';
6+
@use '../core/tokens/m2-utils';
7+
@use '../core/tokens/m3-utils';
58

69
// Tokens that can't be configured through Angular Material's current theming API,
710
// but may be in a future version of the theming API.
@@ -17,17 +20,18 @@
1720

1821
// Tokens that can be configured through Angular Material's color theming API.
1922
@function get-color-tokens($theme) {
23+
$system: m2-utils.get-system($theme);
2024
$is-dark: inspection.get-theme-type($theme) == dark;
2125
$scrim-opacity: 0.6;
22-
$scrim-color: inspection.get-theme-color($theme, system, surface, $scrim-opacity);
26+
$scrim-color: m3-utils.color-with-opacity(map.get($system, surface), 60%);
2327
$fallback-scrim-color: if($is-dark, rgba(#fff, $scrim-opacity), rgba(#000, $scrim-opacity));
2428

2529
@return (
26-
sidenav-container-divider-color: inspection.get-theme-color($theme, system, outline),
27-
sidenav-container-background-color: inspection.get-theme-color($theme, system, surface),
28-
sidenav-container-text-color: inspection.get-theme-color($theme, system, on-surface),
29-
sidenav-content-background-color: inspection.get-theme-color($theme, background, background),
30-
sidenav-content-text-color: inspection.get-theme-color($theme, system, on-surface),
30+
sidenav-container-divider-color: map.get($system, outline),
31+
sidenav-container-background-color: map.get($system, surface),
32+
sidenav-container-text-color: map.get($system, on-surface),
33+
sidenav-content-background-color: map.get($system, background),
34+
sidenav-content-text-color: map.get($system, on-surface),
3135

3236
// We use invert() here to have the darken the background color expected to be used.
3337
// If the background is light, we use a dark backdrop. If the background is dark, we

0 commit comments

Comments
 (0)