Making a Windows Dark Mode Toggle Button

There are many posts around the interwebs showing how to toggle Windows dark mode based on time of day.  I had a slightly different need.  I often work outdoors, so going back to light mode on demand is handy.  After a bit of digging, I came up with the following:

 


Save that script in a file with a .ps1 extension, and it becomes an executable Powershell file which will turn dark mode on/off when run.

 

Personally, I wanted a button on my start menu to trigger the script, so the rest of this post is just a description of how to trigger an executable from a start menu icon.

First, create a shortcut by right clicking file and selecting "create shortcut".  You can choose a nice icon to go with it if you like.  The command should be something like this:


powershell.exe -ExecutionPolicy Bypass -File "ToggleDarkMode.ps1"

Note: Read up on powershell execution policy to determine the appropriate setting for your situation.

Then, save the shortcut in C:\ProgramData\Microsoft\Windows\Start Menu\Programs


Second, use the start menu search to find the shortcut file, right click it, and select "pin to start"

 

 The result is a handy little button:

 

 

 

Comments

Popular posts from this blog

Fixing Conan Lock Issues

Dynamic Object Oriented programming in ArchestrA

Initialize With Care