在我的Polymer项目中,我有一个工具栏,其中包含我想要使用JavaScript更改的颜色.由于Polymer在内部使用CSS变量 - paper-toolbar-background进行样式化,因此我无法执行style.color之类的操作.我找到了一个名为的方法setProperty(),但它对我不起作用.有没有人找到解决方案?
在Chrome中,您可以使用元标签设置标签的颜色
<meta name="theme-color" content="#FFA000">
Run Code Online (Sandbox Code Playgroud)
在我的网站上,我有几个颜色编码的部分.为了让它看起来更好,我想根据当前打开的部分动态更改选项卡的颜色.我试过用jQuery做的:
$("meta[name='theme-color']").attr('content', '#455A64');
Run Code Online (Sandbox Code Playgroud)
但它不起作用.如果有人能告诉我是否/如何在运行时更改此元值,我将非常高兴.
编辑:经过一些检查后,我注意到代码确实更改了元标记内容,但Chrome不会更新标签颜色.