[英]AngularJS Material Design: Different colors for the active tab (using theme colors)
Similar to the question referenced below, I am trying to set the background and foreground color of the active tab label using theme colors. 与下面引用的问题类似,我试图使用主题颜色设置活动选项卡标签的背景和前景色。 I mostly expected referencing the theme colors identifiers in CSS to not work. 我最期望在CSS中引用主题颜色标识符不起作用。 Is there a proper way to do so? 有适当的方法吗?
AngularJS Material Design : Different colors for different tabs in md-tabs AngularJS材质设计:md-tabs中不同选项卡的不同颜色
works: 作品:
.md-tab.md-active
{
background: green;
}
doesn't work: 不起作用:
.md-tab.md-active
{
background: accent;
}
The md-colors
directive works with either value within an html tag, but they don't apply to the specific portions of md-tabs or md-tab that I would like: md-colors
指令可与html标记中的任一值一起使用,但不适用于我想要的md-tabs或md-tab的特定部分:
<div md-colors="{color: 'accent', background: 'green'}">My Text</div>
What I'm trying to do is avoid hard coding the color that happens to be the accent (or could be primary) in the CSS. 我想做的是避免硬编码CSS中恰好是重音(或可能是主要色)的颜色。 I'm thinking there is a way to programmatically determine the colors of accent/primary and then apply the colors. 我在想有一种方法可以以编程方式确定口音/基色的颜色,然后应用这些颜色。 I haven't figured it out yet. 我还没弄清楚。
I think the issue is that you are trying to set the color to 'accent' which is not a color. 我认为问题在于您正在尝试将颜色设置为不是颜色的“强调”。 As a variable it works in an Angular directive, but not is vanilla css. 作为变量,它可以在Angular指令中工作,而不能用于vanilla css。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.