@@ -27,21 +27,32 @@ $_mat-button-ripple-opacity: 0.1;
27
27
}
28
28
}
29
29
30
+ // Applies the background color for a ripple. If the value provided is not a Sass color,
31
+ // we assume that we've been given a CSS variable. Since we can't perform alpha-blending
32
+ // on a CSS variable, we instead add the opacity directly to the ripple element.
33
+ @mixin _mat-button-ripple-background ($palette , $hue , $opacity ) {
34
+ $background-color : mat-color ($palette , $hue , $opacity );
35
+ background-color : $background-color ;
36
+ @if (type-of ($background-color ) != color ) {
37
+ opacity : $opacity ;
38
+ }
39
+ }
40
+
30
41
@mixin _mat-button-ripple-color ($theme , $hue , $opacity : $_mat-button-ripple-opacity ) {
31
42
$primary : map-get ($theme , primary );
32
43
$accent : map-get ($theme , accent );
33
44
$warn : map-get ($theme , warn );
34
45
35
46
& .mat-primary .mat-ripple-element {
36
- background-color : mat-color ($primary , $hue , $opacity );
47
+ @include _mat-button-ripple-background ($primary , $hue , $opacity );
37
48
}
38
49
39
50
& .mat-accent .mat-ripple-element {
40
- background-color : mat-color ($accent , $hue , $opacity );
51
+ @include _mat-button-ripple-background ($accent , $hue , $opacity );
41
52
}
42
53
43
54
& .mat-warn .mat-ripple-element {
44
- background-color : mat-color ($warn , $hue , $opacity );
55
+ @include _mat-button-ripple-background ($warn , $hue , $opacity );
45
56
}
46
57
}
47
58
0 commit comments