humbass
V2EX  ›  CSS

关于主题切换的疑问

  •  
  •   humbass · Oct 24, 2022 · 2140 views
    This topic created in 1350 days ago, the information mentioned may be changed or developed.

    本人是业余程序员,CSS 基础会写,早期就有换主题这个问题,一般是需要定义两套 CSS ,然后切换;

    现在 MacOS 的 Light, Dark 这样的主题,也是需要写两套吗?

    2 replies    2022-10-25 17:05:51 +08:00
    fixbug
        1
    fixbug  
       Oct 24, 2022
    可以了解下 CSS 扩展语言 - Sass 或 Less ,把你想要发生变化的样式,作为变量声明出来。
    可以参考一些开源的 UI 组件,例如: https://ant.design/index-cn
    P233
        2
    P233  
       Oct 25, 2022
    亮 / 黑 两套主题,不考虑 IE ,现在都是通过 CSS custom property 实现的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2936 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 13:02 · PVG 21:02 · LAX 06:02 · JFK 09:02
    ♥ Do have faith in what you're doing.