windows 10 dark mode enabled easy tutorial

Switch to the Dark Theme by Night on Windows 10

Published by Soufiane Sabiri | Categories : Computers - Tips & Tricks - Computers - Windows 10

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.

enable dark mode windows auto 3 light dark

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.

enable dark mode windows auto 1 notepad

Powershell Script for Dark Color Mode

Open Notepad and paste the following script. Save it as a DarkWindows.ps1.

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 LightWindows.ps1.

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“.

enable dark mode windows auto 2 save file

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.

enable dark mode windows auto 4 taskschd msc

On the Actions pane, click on “Create Basic Task…“. This will open the task wizard.

enable dark mode windows auto 5 create basic task

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 >“.

enable dark mode windows auto 6 create basic task name

Select “Daily” in the Trigger since we want our task to perform every day and night. Click on “Next >” again.

enable dark mode windows auto 7 daily

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 >“.

enable dark mode windows auto 8 hour

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.

enable dark mode windows auto 9 start a program

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\powershell.exe -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\powershell.exe -ExecutionPolicy Bypass -File "C:\users\pc\Desktop\LightWindows.ps1"

Click “Next >“.

enable dark mode windows auto 10 program script

Click “Yes” if you see an alert confirming the parameters you’ve set on.

enable dark mode windows auto 11 task scheduler yes

Done!

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!


Related tutorials:


Author: Soufiane Sabiri

Soufiane is a young computer scientist and specialist in web design, knows a lot of things in the computer world. This enthusiast enjoys helping people innovate and learn more about the IT world...

Be the first to leave a comment !

Leave a comment

xD oO ^_^ =] =) ;-( ;) :| :woot: :whistle: :sleep: :sick: :police: :p :o :ninja: :mm: :love: :lol: :kiss: :hmm: :evil: :bandit: :angel: :alien: :D :) :( 8)