Skip to content

Commit

Permalink
handle CSS var elevation colors
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba committed Aug 18, 2022
1 parent 29abfb4 commit 3188791
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/material/core/style/_elevation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,21 @@ $prefix: 'mat-elevation-z';
// Applies the correct css rules to an element to give it the elevation specified by $zValue.
// The $zValue must be between 0 and 24.
@mixin elevation($zValue, $color: $color) {
@include mdc-elevation.elevation($zValue, $color);
@if meta.type-of($color) == color {
@include mdc-elevation.elevation($zValue, $color);
} @else {
// Copied from @material/elevation/_elevation-theme.scss#_box-shadow
// TODO(mmalerba): Add support for graceful handling of CSS var color to MDC.
$umbra-z-value: map.get(mdc-elevation.$umbra-map, $zValue);
$penumbra-z-value: map.get(mdc-elevation.$penumbra-map, $zValue);
$ambient-z-value: map.get(mdc-elevation.$ambient-map, $zValue);
$box-shadow: (
#{'#{$umbra-z-value} #{$color}'},
#{'#{$penumbra-z-value} #{$color}'},
#{$ambient-z-value} $color
);
@include mdc-elevation.shadow($box-shadow);
}
}

// Applies the elevation to an element in a manner that allows
Expand Down

0 comments on commit 3188791

Please sign in to comment.