【发布时间】:2018-06-26 01:24:58
【问题描述】:
编辑:我不想在可以使用预定义调色板的地方使用角度主题。我想为深色和浅色类使用自定义颜色。
我们能否有一个styles.sass(它是主要的sass)文件如下:
.light {
$background:#ffffff;
$text-foreground: #000000;
$text-foreground-onhover: #ffffff;
$text-background-onhover: #000000;
}
.dark{
$background:#000000;
$text-foreground: #ffffff;
$text-foreground-onhover: #000000;
$text-background-onhover: #ffffff;
}
在单个组件的 sass 文件中..(比如说 dummycomp.sass) (即使我在 dummycomp.sass 中导入 main.sass 也会引发错误,因为 $text-foreground 不能直接访问:()
.div{
color:$text-foreground;
}
在 app.component.html.. 根据条件,我可以切换深色或浅色类。
<div [ngClass]="selectedClass">
....... // The main app content lies here
....... // selectedClass can be either light or dark
</div>
【问题讨论】:
标签: css angular dynamic sass styling