[CSS3] Use media query to split css files and Dark mode (prefers-color-scheme: dark)
时间:2019-12-02 20:25:28
收藏:0
阅读:114
Dark Mode:
:root { --text-color: #000; --background-color: #fff; } body { color: var(--text-color); background-color: var(--background-color) } @media (prefers-color-scheme: dark) { :root { --text-color: #fff; --background-color: #000; } }
If our application has multi themes, we don‘t need to iclude all the code in the init downlading.
If there is no dark mode enabled for the site, we can force the light mode to be loaded:
Dark mode by web component:
https://www.webcomponents.org/element/dark-mode-toggle
原文:https://www.cnblogs.com/Answer1215/p/11972750.html
评论(0)