【发布时间】:2021-09-30 09:23:19
【问题描述】:
根据来自 Angular 的 configuration guide 关于 bugdet 大小的信息,我有 2kb 样式的预算。一旦我包含 Material 颜色主题,我的大小就会超过 14kb,即比预期的多 12kb。
根据 Material 的style guide,不同的调色板应该相互协调。
@use '~@angular/material' as mat;
@include mat.core();
$app-primary: mat.define-palette(mat.$indigo-palette);
$app-teal: mat.define-palette(mat.$teal-palette);
$app-theme: mat.define-light-theme($app-primary, $app-teal);
// Create a config with the default typography levels.
$config: mat.define-typography-config();
@mixin mix-app-theme($app-theme) {
.mat-button-toggle-checked {
background-color: mat.get-color-from-palette($app-teal, 400);
// background-color: var(--mat-color-teal-400);
color: mat.get-color-from-palette($app-teal, default-contrast);
}
}
// Include the mixin
@include mix-app-theme($app-theme);
有没有办法遵循配置指南并且仍然可以使用不同的调色板?
【问题讨论】: