Skip to content

Commit b76d941

Browse files
committed
refactor: use system level shadow color for elevation
1 parent a62164d commit b76d941

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/material/core/_m2-app.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
);
2020

2121
@for $zValue from 0 through 24 {
22-
$elevation-color: inspection.get-theme-color($theme, foreground, elevation);
23-
$shadow: elevation.get-box-shadow($zValue,
24-
if($elevation-color == null, elevation.$color, $elevation-color));
22+
$shadow: elevation.get-box-shadow($zValue, map.get($system, shadow));
2523
$tokens: map.set($tokens, 'app-elevation-shadow-level-#{$zValue}', $shadow);
2624
}
2725

src/material/core/m2/_theming.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
hover-state-layer-opacity: 0.04,
135135
focus-state-layer-opacity: 0.12,
136136
pressed-state-layer-opacity: 0.12,
137+
shadow: black,
137138
),
138139
);
139140
}
@@ -159,6 +160,7 @@
159160
hover-state-layer-opacity: 0.04,
160161
focus-state-layer-opacity: 0.12,
161162
pressed-state-layer-opacity: 0.12,
163+
shadow: black,
162164
),
163165
);
164166
}

src/material/core/style/_private.scss

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
@use './elevation';
22
@use '../theming/inspection';
3+
@use '../tokens/m2-utils';
4+
@use '../tokens/m3-utils';
5+
@use 'sass:map';
36

47
@mixin private-theme-elevation($zValue, $theme) {
5-
$elevation-color: inspection.get-theme-color($theme, foreground, elevation);
6-
$elevation-color-or-default: if($elevation-color == null, elevation.$color, $elevation-color);
7-
8-
@include elevation.elevation($zValue, $elevation-color-or-default);
8+
$system: m2-utils.get-system($theme);
9+
@include elevation.elevation($zValue, map.get($system, shadow));
910
}
1011

1112
@mixin private-theme-overridable-elevation($zValue, $theme) {
12-
$elevation-color: inspection.get-theme-color($theme, foreground, elevation);
13-
$elevation-color-or-default: if($elevation-color == null, elevation.$color, $elevation-color);
14-
15-
@include elevation.overridable-elevation($zValue, $elevation-color-or-default);
13+
$system: m2-utils.get-system($theme);
14+
@include elevation.overridable-elevation($zValue, map.get($system, shadow));
1615
}
1716

1817
// If the mat-animation-noop class is present on the components root element,

0 commit comments

Comments
 (0)