How to enable Android P’s Dark Theme when Night Light is on

We may earn a commission for purchases made using our links.

With the Google Pixel 2, Google added a partial system dark theme that gets applied when you have a dark-colored wallpaper. That feature came to the original Google Pixel and other devices with the Android 8.1 Oreo update and with the latest Android P Beta 3/Developer Preview 4, you no longer need to have a dark-colored wallpaper to use the dark theme. If you’ve ever wanted to make the dark mode a bit smarter, we figured out how to automate it so you can apply any condition before it’s enabled. The best part is it doesn’t require root!

For reference, the dark theme only themes parts of the SystemUI and Google Pixel Launcher such as the quick settings panel, volume panel, folder background, and app drawer background. The only way to get a full system-wide dark theme is to either remain on Android Oreo and use a Substratum theme or to root your Android P device to use Substratum. We realize that rooting your device isn’t something that some of you may want to do, so we’re always looking for customization options that don’t require root. Thanks to the latest Android P beta, it’s now possible to automate when the dark theme is applied so, for example, we can enable the dark mode only when Night Light is on.

Trigger Android P’s Dark Theme with Night Light

A brief explanation on what we’re doing. The latest Android P beta allows you to manually toggle the dark theme in Display settings. As such, a new Settings.Secure value was made by Google to hold the current value of this setting (Settings.Secure.theme_mode where 0 is automatic based on wallpaper, 1 is the light theme, and 2 is the dark theme.) Changing this value manually via ADB or with an application with the right permission allows us to change the theme. Using the latest Tasker beta version which allows us to monitor for changes in settings, we can monitor the Night Light state and then toggle the theme change at will.

Requirements

Instructions

Here are step-by-step instructions on how to set it up. At the end, I will also include a link to import it.

Open Tasker and create a new Profile. Name it “Automatic Dark Theme At Night.” Choose the State Context. Pick the System category. Select the Custom Setting option. For the Type, pick “Secure”. For the Name, enter “night_display_activated”. For the Value, enter “1”. Enter the Task creation (no need to name the Task.) Add an Action. Pick the Settings category. Choose Custom Setting. For the Type, pick “Secure”. For the Name, enter “theme_mode”. For the Value, enter “2”. This will enable the dark theme when Night Light is on. Exit the Task creation and go back to Tasker’s main screen. Long-press on the Task you created and select “Add Exit Task.” Repeat steps 7-10 however for the Value in step 10, enter “1”. This will disable the dark theme when Night Light is off. You’re done. Now Tasker will automatically toggle the dark mode whenever Night Light is toggled. You can either toggle Night Light manually, set it on a custom schedule, or set it to enable based on the sun cycle.

Click here to import the Profile above. Note: this is using Tasker’s new URL import/export feature which is only available on the latest Tasker beta. The Profile won’t work if you’re not on the latest Tasker beta anyways.