You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As we discussed over QQ, it's easy to implement prefers-color-scheme with WordPress.
This media query is compatible with almost all modern browsers.
You could either tell the theme to load darkmode.css if the user has set their system to dark mode
OR
add the CSS for dark mode with the main scss.
Here's the logic:
@media (prefers-color-scheme: dark) {
body {
background-color: #121212;color: #fafafa;}
/* rest of the css */
}
@media (prefers-color-scheme: light) {
body {
background-color: #fafafa;color: #121212;}
/* rest of the dark mode css */
}
verfasor
changed the title
You may consider prefers-color-scheme instead of separate light/dark mode switcher.
consider prefers-color-scheme if possible.
Dec 27, 2019
As we discussed over QQ, it's easy to implement
prefers-color-scheme
with WordPress.This media query is compatible with almost all modern browsers.
You could either tell the theme to load darkmode.css if the user has set their system to dark mode
OR
add the CSS for dark mode with the main scss.
Here's the logic:
You can refer to my blog post for clarity: https://mighil.com/automatic-dark-mode-for-wordpress/
功能描述
Talk about the details of the feature you request here.
附加内容
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: