有没有办法添加更多的颜色变量而不仅仅是“主要”,“重音”和“警告”?
答案 0 :(得分:2)
这很简单,你必须以这种方式添加:
@import '~@angular/material/theming';
@include mat-core();
$my-app-primary: mat-palette($mat-blue-grey);
$my-app-accent: mat-palette($mat-pink, 500, 900, A100);
$my-app-warn: mat-palette($mat-deep-orange);
$my-app-theme: mat-light-theme($my-app-primary, $my-app-accent, $my-app-warn);
@include angular-material-theme($my-app-theme);
.alternate-theme {
$alternate-primary: mat-palette($mat-light-blue);
$alternate-accent: mat-palette($mat-yellow, 400);
$alternate-theme: mat-light-theme($alternate-primary, $alternate-accent);
@include angular-material-theme($alternate-theme);
}
然后:
<md-card>
Main Theme:
<button md-raised-button color="primary">
Primary
</button>
<button md-raised-button color="accent">
Accent
</button>
<button md-raised-button color="warn">
Warning
</button>
</md-card>
<md-card class="alternate-theme">
Alternate Theme:
<button md-raised-button color="primary">
Primary
</button>
<button md-raised-button color="accent">
Accent
</button>
<button md-raised-button color="warn">
Warning
</button>
</md-card>