Do you want to switch to dark themes for all UWP apps including Settings app by night?
As you may know Windows 10 has got two color modes or themes, Dark and Light. You can switch between the two themes from the Settings app (“Personalization” > “Colors” > “Choose app mode”). Though it’s a useful thing to do especially at night to protect our eyes from white light; it’s really time-consuming!
This is why I found a trick that implements some scripts and the task scheduler of Windows in order to switch the color mode automatically. You can still use the shortcuts manually to help you save some extra time and not having to access to the Settings app.
Here’s how you can automatically switch to the dark theme by night in Windows 10 using a little script and a scheduled task.
Create Scripts to Switch to Dark/Light Themes
For this to work you won’t need any administrative rights to switch to the dark theme at night. We are going to create two text files, to open Notepad open Run (Win+R) and type
notepad. The code of the scripts is below for you to copy and paste. It’s a single line code for each file.
Powershell Script for Dark Color Mode
Open Notepad and paste the following script. Save it as a
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force
Powershell Script for Light Color Mode
Open Notepad and paste the following script. Save it as
Remove-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme
Put a File name and choose “All Files (*.*)” in “Save as type:” and click “Save“.
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 by running the command
taskschd.msc in Run (Win+R) or search Task Scheduler in the Start menu.
On the Actions pane, click on “Create Basic Task…“. This will open the task wizard.
Enter a name for the task (e.g Dark Theme) and give it a proper description. The description is optional but it does help you know what the task is for. Click on “Next >“.
Select “Daily” in the Trigger since we want our task to perform every day and night. Click on “Next >” again.
Put a time when the sun sets off or any time you feel like it’s dark enough for the Dark color mode to get turned ON. Click “Next >“.
Now do the same with the Light color mode’ task. But choose a time in the morning that you most probably will have your computer turned on.
In the “Start a Program” page, we are going to paste the powershell code that will execute those tasks.
For the dark color mode, enter the following in the browse field;
%SystemRoot%\system32\WindowsPowerShell\v1.0\-ExecutionPolicy Bypass -File "C:\users\pc\Desktop\DarkWindows.ps1"
For the light color mode, enter the following in the browse field;
%SystemRoot%\system32\WindowsPowerShell\v1.0\-ExecutionPolicy Bypass -File "C:\users\pc\Desktop\LightWindows.ps1"
Click “Next >“.
Click “Yes” if you see an alert confirming the parameters you’ve set on.
Please keep in mind that theses tasks won’t be able to 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 can always run the scripts manually by right-click then choosing “Run with Powershell“.
If you want to remove the task created just go to
C:\windows\system32\tasks and delete the corresponding task.
If you have any questions feel free to post a comment down below, thanks a lot!
Soufiane - Easytutorial.com