How to do auto light/dark mode switching using global variables #168
Pinned
KevinBatdorf
started this conversation in
General
Replies: 2 comments 2 replies
-
@KevinBatdorf Do you know if this should work as is with the WP Dark Mode plugin? (It does not appear to) https://wordpress.org/plugins/wp-dark-mode/ Maybe, I can add some Code Block Pro Dark Mode CSS changes to this area in the plugin to get it working? |
Beta Was this translation helpful? Give feedback.
1 reply
-
It would be great if we could pick from the list of existing themes for both light and dark mode. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As a prerequisite, you need to have a theme pack license. You can get one here. This is a paid feature.
After you install and activate it, insert a code block and open the themes panel.
At the top you will see a pretty bland-looking, generic theme. It might look something like this:
Select that theme and save the page.
Next (or do this before if you'd like), you need to add some CSS to your site in order for the styles to show up.
This is a bit verbose, but covers both light and dark modes based on the user's device.
Put this somewhere like functions.php or where is best to put PHP code (leave a comment below or email me if unsure).
You don't necessarily need to set all of these, but it's good to look at your code and tweak it until it looks how you want. It will probably take a bit of trial and error to get it perfect. Also, if you don't care about dark mode, then just remove the bottom half of the code snippet.
Beta Was this translation helpful? Give feedback.
All reactions