小编yaz*_*azz的帖子

How to apply Angular Material theme to non-material components?

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 …

html css angular-material2 angular

4
推荐指数
1
解决办法
2759
查看次数

标签 统计

angular ×1

angular-material2 ×1

css ×1

html ×1