Skip to content

Commit a9e0ac5

Browse files
authored
fix(material-experimental/mdc-snack-bar): support dark themes (#19926)
Sets up the variables so that we can generate the correct colors for dark themes. Also updates us to the latest MDC canary which has a relevant fix for `mat-table`.
1 parent 63da9e3 commit a9e0ac5

File tree

3 files changed

+578
-533
lines changed

3 files changed

+578
-533
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"@types/youtube": "^0.0.38",
6060
"@webcomponents/custom-elements": "^1.1.0",
6161
"core-js": "^2.6.9",
62-
"material-components-web": "7.0.0-canary.7461aad68.0",
62+
"material-components-web": "8.0.0-canary.d850de590.0",
6363
"rxjs": "^6.5.3",
6464
"rxjs-tslint-rules": "^4.33.1",
6565
"systemjs": "0.19.43",

src/material-experimental/mdc-snack-bar/_snack-bar-theme.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
11
@import '../mdc-helpers/mdc-helpers';
2+
@import '@material/theme/functions.import';
3+
@import '@material/snackbar/variables.import';
24
@import '@material/snackbar/mixins.import';
35

46
@mixin mat-mdc-snack-bar-color($config-or-theme) {
57
$config: mat-get-color-config($config-or-theme);
8+
9+
$orig-mdc-snackbar-fill-color: $mdc-snackbar-fill-color;
10+
$orig-mdc-snackbar-label-ink-color: $mdc-snackbar-label-ink-color;
11+
$orig-mdc-snackbar-dismiss-ink-color: $mdc-snackbar-dismiss-ink-color;
12+
613
@include mat-using-mdc-theme($config) {
14+
$mdc-snackbar-fill-color: mix(
15+
mdc-theme-prop-value(on-surface),
16+
mdc-theme-prop-value(surface),
17+
80%
18+
) !global;
19+
$mdc-snackbar-label-ink-color: rgba(
20+
mdc-theme-prop-value(surface),
21+
mdc-theme-text-emphasis(high)
22+
) !global;
23+
$mdc-snackbar-dismiss-ink-color: rgba(
24+
mdc-theme-prop-value(surface),
25+
mdc-theme-text-emphasis(high)
26+
) !global;
27+
728
@include mdc-snackbar-core-styles($query: $mat-theme-styles-query);
829
}
30+
31+
$mdc-snackbar-fill-color: $orig-mdc-snackbar-fill-color !global;
32+
$mdc-snackbar-label-ink-color: $orig-mdc-snackbar-label-ink-color !global;
33+
$mdc-snackbar-dismiss-ink-color: $orig-mdc-snackbar-dismiss-ink-color !global;
934
}
1035

1136
@mixin mat-mdc-snack-bar-typography($config-or-theme) {

0 commit comments

Comments
 (0)