【发布时间】:2018-09-25 15:35:23
【问题描述】:
我正在使用带有原色和强调色的角材质主题。我有两个不同的主题定义为最终用户可以动态更改的橙色和绿色。 theme.scss 如下所示
@import '~@angular/material/theming';
@include mat-core();
@mixin widget-theme($theme) {
$primary: map-get($theme, primary);
$accent: map-get($theme, accent);
.fa-icon {
color: mat-color($primary);
}
.fa-table-data-row-selected {
background-color: mat-color($accent) !important;
color: #152A23
}
.fa-text-link {
color: #2A5D9F;
}
}
$custom-primary: mat-palette($mat-blue-grey,500);
$custom-accent: mat-palette($mat-light-blue, A200);
$custom-warn: mat-palette($mat-red);
$custom-theme: mat-light-theme($custom-primary, $custom-accent, $custom-warn);
@include angular-material-theme($custom-theme);
@include widget-theme($custom-theme);
//Orange theme
$ora-primary: mat-palette($mat-orange, 800);
$ora-accent: mat-palette($mat-deep-purple, A100);
$ora-theme: mat-light-theme($ora-primary, $ora-accent);
.orange-theme {
@include angular-material-theme($ora-theme);
@include widget-theme($ora-theme);
}
//green theme
$green-primary: mat-palette($mat-green, 800);
$green-accent: mat-palette($mat-lime, A700);
$green-theme: mat-light-theme($green-primary, $green-accent);
.green-theme {
@include angular-material-theme($green-theme);
@include widget-theme($green-theme);
}
我的整体配色方案使用原色和强调色非常出色。但是,请注意我有一个表的用例,并且使用带有 css fa-table-data-row-selected 的强调色来使用选定的行颜色。所选行的文本颜色当前是硬编码的。显然,这不适用于所有强调色,并且可能看起来完全不可读。因此,这也应该根据选择的主题动态更改。
这里有什么建议?我不能清楚地使用原色或强调色,因为那可能看起来不是最好的。它可能需要一些其他变量,该变量的值取决于选择的主题。
【问题讨论】:
标签: css angular sass themes angular-material2