所以我有一个Angular 2 Material应用程序.而我想做的只是通过点击简单来切换/切换主题从黑暗到光明button.
我该怎么做 ?
I am using Angular Material 2 themes for my Angular 4 app. I have the following themes created in my theme.scss
@import '~@angular/material/theming';
@include mat-core();
$primary-color: mat-palette($mat-grey);
$accent-color: mat-palette($mat-blue, 500, 900, A100);
$warning-color: mat-palette($mat-red);
$dark-theme: mat-dark-theme($primary-color, $accent-color, $warning-color);
$light-theme: mat-light-theme($primary-color, $accent-color, $warning-color);
Run Code Online (Sandbox Code Playgroud)
And in my style.scss, I have the following
@import 'theme.scss';
.dark-theme {
@include angular-material-theme($dark-theme);
}
.light-theme {
@include angular-material-theme($light-theme);
}
Run Code Online (Sandbox Code Playgroud)
In my HTML I have hardcoded the dark theme (eventually I want to give the user an option …