Automatically Switch To The Dark Theme At Night In Windows 10
Windows 10 has a dark and light theme. It applies to all UWP apps. Users can switch to the dark or light theme from the Settings app. What they can’t do is schedule when Windows 10 will automatically switch to a dark or light theme. The Creators Update expected to arrive this month has a Night Light feature that will tint your screen a warm color. You can schedule Night Light but it isn’t the same as switching to the dark theme at night. Here’s how you can automatically switch to the dark theme at night in Windows 10 using a little script and a scheduled task.
You don’t need administrative rights to switch to the dark theme at night. This is something a standard user can do. We’re going to be doing it via a script. You will need to create two scripts; one to switch to the dark theme at night, and one to switch back to the light theme when it’s day.
Script For Dark Theme
Open Notepad and paste the following. Save it as a PS1 file with a suitable name like Dark Theme.
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force
Script For Light Theme
Open Notepad and paste the following. Save this file as a PS1 file named Light Theme, or something similar.
Remove-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme
Create Scheduled Tasks
We’re now going to create two scheduled tasks. The first task will run the Dark Theme script you just created. The second task will run the Light Theme script. We will use the built-in Task Scheduler app to create and run these tasks. You do not need administrative rights to create and run tasks.
Open Task Scheduler; type Task Scheduler in the Windows search bar and select the app from the search results.
On the Actions pane, select ‘Create Basic Task’. This will open the task wizard. Enter a name for the task and give it a description. The description is optional but it’s a good idea to add one so you know what the script does. Click ‘Next’.
On the ‘Task Trigger’ screen, select the ‘Daily’ option and click ‘Next again.
To switch to the dark theme at night, set the time to sunset or whenever you think ‘night’ officially starts. Set it to a time when your system will be running e.g., 6PM.
To switch back to the light theme in the morning, enter whenever you consider it to be morning. Set it to a time when you know your system will be active e.g. 8AM and not 4AM when the system is likely to be asleep or Off.
On the ‘Actions’ screen, select ‘Start a program’ and click Next. This is where things will be slightly different for the dark and light scripts you want to run.
For the dark theme, enter the following in the browse field;
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\path-to-script\name-of-Dark-theme-script.ps1"
For the light theme, enter the following in the browse field;
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\path-to-script\name-of-Light-theme-script.ps1"
You will see an alert confirming the parameters you’ve set. Click ‘Yes’ on the alert and you’re all done.
A Caveat
The tasks cannot run if your system is asleep or hibernating. If you set the task to run at a time when your system is likely to be in an off state, this won’t work for you. You will have to manually run the scripts. This is why you have to be careful when you set the time for the task to be run. Set it to a time you know your system will be running.
This little trick is the brainchild of Reddit user exile09.