How to do auto light/dark mode switching using global variables #168
Pinned
KevinBatdorf
started this conversation in
General
Replies: 0 comments
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