|
2 | 2 | @import '../core/style/elevation';
|
3 | 3 | @import '../core/typography/typography-utils';
|
4 | 4 |
|
| 5 | +$_mat-button-ripple-opacity: 0.1; |
| 6 | + |
5 | 7 | // Applies a focus style to an mat-button element for each of the supported palettes.
|
6 | 8 | @mixin _mat-button-focus-overlay-color($theme) {
|
7 | 9 | $primary: map-get($theme, primary);
|
|
25 | 27 | }
|
26 | 28 | }
|
27 | 29 |
|
28 |
| -@mixin _mat-button-ripple-color($theme, $hue, $opacity: 0.1) { |
| 30 | +@mixin _mat-button-ripple-color($theme, $hue, $opacity: $_mat-button-ripple-opacity) { |
29 | 31 | $primary: map-get($theme, primary);
|
30 | 32 | $accent: map-get($theme, accent);
|
31 | 33 | $warn: map-get($theme, warn);
|
|
87 | 89 | @include _mat-button-theme-property($theme, 'color', default);
|
88 | 90 | @include _mat-button-focus-overlay-color($theme);
|
89 | 91 |
|
90 |
| - // Setup the ripple color to be based on the color palette. The opacity can be a bit weaker |
91 |
| - // than for icon-buttons, because normal and stroked buttons have a focus overlay. |
92 |
| - @include _mat-button-ripple-color($theme, default); |
| 92 | + // Setup the ripple color to be based on the text color. This ensures that the ripples |
| 93 | + // are matching with the current theme palette and are in contrast to the background color |
| 94 | + // (e.g in themed toolbars). |
| 95 | + .mat-ripple-element { |
| 96 | + opacity: $_mat-button-ripple-opacity; |
| 97 | + background-color: currentColor; |
| 98 | + } |
93 | 99 | }
|
94 | 100 |
|
95 | 101 | .mat-button-focus-overlay {
|
|
112 | 118 | @include _mat-button-ripple-color($theme, default-contrast);
|
113 | 119 | }
|
114 | 120 |
|
115 |
| - // Since icon buttons don't have a focus overlay, the ripple opacity should be the higher |
116 |
| - // than the default value. |
117 |
| - .mat-icon-button { |
118 |
| - @include _mat-button-ripple-color($theme, default, 0.2); |
119 |
| - } |
120 |
| - |
121 | 121 | .mat-stroked-button, .mat-flat-button {
|
122 | 122 | @include _mat-theme-overridable-elevation(0, $theme);
|
123 | 123 | }
|
|
0 commit comments