Skip to content

Commit 4d67427

Browse files
andrewseguinAndrew Seguin
and
Andrew Seguin
authored
fix(material/core): update ripple tokens to system colors (#31282)
Co-authored-by: Andrew Seguin <[email protected]>
1 parent 576a008 commit 4d67427

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/material/core/ripple/_m2-ripple.scss

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
@use 'sass:meta';
2-
@use '../theming/inspection';
1+
@use 'sass:map';
2+
@use '../tokens/m2-utils';
3+
@use '../tokens/m3-utils';
34

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

1011
// Tokens that can be configured through Angular Material's color theming API.
1112
@function get-color-tokens($theme) {
12-
$is-dark: inspection.get-theme-type($theme) == dark;
13-
$base: inspection.get-theme-color($theme, foreground, base);
14-
15-
// If the base is a color *type* we can use it directly in the `rgba` call below.
16-
// If it's anything else (e.g. a CSS variable) we fall back to using static colors
17-
// since we don't have a way of adjusting the opacity.
18-
$color: if(meta.type-of($base) == color, $base, if($is-dark, #fff, #000));
13+
$system: m2-utils.get-system($theme);
1914

2015
@return (
21-
ripple-color: rgba($color, 0.1),
16+
ripple-color: m3-utils.color-with-opacity(
17+
map.get($system, on-surface), map.get($system, pressed-state-layer-opacity)),
2218
);
2319
}
2420

0 commit comments

Comments
 (0)