【发布时间】:2017-06-29 16:26:15
【问题描述】:
如果我想使用主题中定义的颜色为不是材料 2 组件的元素设置样式,那么标准方法是什么?
假设我在组件中有一个h1 标签,我希望颜色是我的primary color。我希望能够做这样的事情:
h1{
color: $color-primary;
}
目前我有一个 theme.scss 和 styles.scss
theme.scss:
@import '~@angular/material/theming';
@include mat-core();
$color-primary: mat-palette($mat-blue);
$color-accent: mat-palette($mat-amber, A400, A200, A500);
$color-warn: mat-palette($mat-red);
$theme: mat-light-theme($color-primary, $color-accent, $color-warn);
@include angular-material-theme($theme);
我可以在我的component.scss 中导入theme.scss,但是它们是state not to do so:
导入 mat-core() sass mixin。这包括所有常见的样式 由多个组件使用。这应该只包括 一次在您的应用程序中。如果多次包含此 mixin, 您的应用程序最终会得到这些常见的多个副本 样式。
【问题讨论】:
标签: angular material-design angular-material angular-material2