Skip to content

Commit feae8dd

Browse files
committed
refactor: use system background
1 parent 6082c1f commit feae8dd

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

src/material/badge/_m2-badge.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ $_large-size: $_default-size + 6px;
4242
// Tokens that can be configured through Angular Material's color theming API.
4343
@function get-color-tokens($theme) {
4444
$primary-color-tokens: private-get-color-palette-color-tokens($theme, primary);
45-
$app-background: inspection.get-theme-color($theme, background, background);
45+
$app-background: inspection.get-theme-color($theme, system, background);
4646
$disabled-background: inspection.get-theme-color($theme, foreground, disabled-button);
4747

4848
// The disabled color usually has some kind of opacity, but because the badge is overlayed

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: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
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';
57

68
// Tokens that can't be configured through Angular Material's current theming API,
79
// but may be in a future version of the theming API.
@@ -17,17 +19,18 @@
1719

1820
// Tokens that can be configured through Angular Material's color theming API.
1921
@function get-color-tokens($theme) {
22+
$system: m2-utils.get-system($theme);
2023
$is-dark: inspection.get-theme-type($theme) == dark;
2124
$scrim-opacity: 0.6;
22-
$scrim-color: inspection.get-theme-color($theme, system, surface, $scrim-opacity);
25+
$scrim-color: map.get($system, surface, $scrim-opacity);
2326
$fallback-scrim-color: if($is-dark, rgba(#fff, $scrim-opacity), rgba(#000, $scrim-opacity));
2427

2528
@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),
29+
sidenav-container-divider-color: map.get($system, outline),
30+
sidenav-container-background-color: map.get($system, surface),
31+
sidenav-container-text-color: map.get($system, on-surface),
32+
sidenav-content-background-color: map.get($system, background),
33+
sidenav-content-text-color: map.get($system, on-surface),
3134

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

0 commit comments

Comments
 (0)