我正在使用angular2material 构建angular2应用程序.我试图以"正确的方式"设置我的应用程序的背景,但我不知道如何设置.
我发现了一个可以在我的<body>
元素上使用的类:mat-app-background
,我可以添加它,它给了我一个默认的 colored颜色 (取决于我使用的是亮主题还是暗主题).
我想定义这个背景色来使用我品牌的 colored颜色 ,但我不知道怎么做.
在_theming.scss
中,它的定义如下:
// Mixin that renders all of the core styles that depend on the theme.
@mixin mat-core-theme($theme) {
@include mat-ripple-theme($theme);
@include mat-option-theme($theme);
@include mat-pseudo-checkbox-theme($theme);
// Wrapper element that provides the theme background when the
// user's content isn't inside of a `md-sidenav-container`.
.mat-app-background {
$background: map-get($theme, background);
background-color: mat-color($background, background);
}
...
}
因此,我认为try 在我的自定义主题中添加背景色是有意义的,但我不明白如何做到这一点.
在material 2 theming文档上,它只说:
"在Angular Material中,一个主题是通过组合多个选项板来创建的.特别是,一个主题包括:
- 主调色板:在所有屏幕和组件中最广泛使用的 colored颜色 .
- 强调调色板:用于浮动操作按钮和交互元素的 colored颜色 .
- 警告调色板:用于传达错误状态的 colored颜色 .
- 前景调色板:文本和图标的 colored颜色 .
- 背景调色板:用于元素背景的 colored颜色 .
我怎样才能把我的背景添加到主题中,或者以任何其他方式添加到主题中?