duan5731 2016-06-15 00:06
浏览 76

改变主题颜色的最佳方法是什么?

I have a tonne of CSS, and I need the colours of certain elements to change on certain themes that are assigned to a body class.

The most obvious way to approach it would be to gather every class and assign it a colour, eg:

body.blue .btn, 
body.blue .icon,
body.blue .whatever {
   ​background: blue;
}

body.green .btn, 
body.green .icon,
body.green .whatever {
   ​background: green;
}

But I'm wondering if there's a better way to handle it. Even if I use a preprocessor, I'm pretty sure I still need to assign the colour values this way. Other solutions I've read about include using PHP as the stylesheet (CSS tricks) or dynamically switching out stylesheets as needed (though I'd rather not).

Is there a better way to approach all of this, a way where we can use a variable and not have to create massive class lists?

Thanks

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 很想要一个很好的答案或提示
    • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
    • ¥15 怀疑手机被监控,请问怎么解决和防止
    • ¥15 Qt下使用tcp获取数据的详细操作
    • ¥15 idea右下角设置编码是灰色的
    • ¥15 全志H618ROM新增分区
    • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
    • ¥15 NAO机器人的录音程序保存问题
    • ¥15 C#读写EXCEL文件,不同编译
    • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL