我正在使用角度材料2构建angular2应用程序.我试图将我的应用程序的背景设置为"正确的方法",但我无法弄清楚如何.
我找到了一个可以在我的<body>元素上使用的类:mat-app-background我可以添加,它给了我一个默认颜色(取决于我是使用浅色还是暗色主题).
我希望定义这种背景颜色以使用我的品牌颜色,但我无法弄清楚如何做到这一点.
在_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);
}
...
}
Run Code Online (Sandbox Code Playgroud)
所以我认为尝试将背景颜色添加到我的自定义主题是有意义的,不知何故,但我无法理解如何这样做.
在Material2 主题文档中,它只说:
"在Angular Material中,主题是通过组合多个调色板创建的.特别是,主题包括:
如何将我的背景添加到主题中,或以其他任何方式执行此操作?