Home » How To » How to Switch Between Light and Dark Themes Using Desktop Shortcut in Windows 11

How to Switch Between Light and Dark Themes Using Desktop Shortcut in Windows 11

Learn how to create a custom desktop shortcut to switch between light and dark themes in Windows 11 quickly and easily.

Windows 11 supports both light and dark themes. When you want to switch between these themes, you typically need to open the “Personalization” > “Themes” page in the Settings app. While not necessarily a difficult task, switching themes frequently can make this repeated action tiresome. In one of my previous guides, I showed you how to create light mode and dark mode batch files to switch themes in Windows 11. However, if you are looking for a single desktop shortcut that acts as a toggle to switch between the light and dark themes, then this guide is for you.

Once you create the shortcut, it automatically detects the current active theme and switches to the other. For example, if you are currently using the light theme, it switches to the dark theme and vice versa. Let me show you how to do it.

Create a Desktop Shortcut to Switch Between Light and Dark Themes

Before creating the desktop shortcut, we will create a PowerShell script that checks and switches the theme. After that, we will create a desktop shortcut for that script. Here’s how.

First, open the Start menu by pressing the “Windows key”. Search for “Notepad” and click the “Open” option.

open notepad

Once the Notepad window opens, paste the following code into it. Next, click the “File” option at the top and select “Save As“.

<#
  Script Name: Switch themes
  Description: This script detects and switches theme between light and dark modes
  Author: Bashkarla Vamsi
  URL: https://windowsloop.com
#>

$RegistryPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
$AppName = "AppsUseLightTheme"
$SystemName = "SystemUsesLightTheme"

# Get current theme. Default to light if the registry value doesn't exist.
try {
   $CurrentValue = Get-ItemProperty -Path $RegistryPath -Name $AppName -ErrorAction Stop
} catch {
   $CurrentValue = $null
}

# If light (value is 1 or null), toggle to dark. Otherwise, toggle to light.
if ($CurrentValue -eq $null -or $CurrentValue.AppsUseLightTheme -eq 1) {
   Set-ItemProperty -Path $RegistryPath -Name $AppName -Value 0
   Set-ItemProperty -Path $RegistryPath -Name $SystemName -Value 0
}
else {
   Set-ItemProperty -Path $RegistryPath -Name $AppName -Value 1
   Set-ItemProperty -Path $RegistryPath -Name $SystemName -Value 1
}

# Refresh explorer to apply changes. Windows auto-restarts it.
Stop-Process -Name explorer -Force
click file and then save as

Go to a folder where you want to save the script file, type the name as “toggle-theme.ps1” in the “File name” field, select “All files” from the “File type” dropdown menu, and click “Save“.

name the save file

After creating and saving the script, go to your desktop by pressing the “Windows key + D” shortcut. Next, right-click on the desktop and select “New“, then “Shortcut.”

click new and then shortcut

Paste the following path in the “location” field. Don’t forget to replace the dummy path with the actual path of the script file we just created. You can right-click on the script file and select “Copy as path” to copy the file path. Click “Next” to continue.

powershell.exe -ExecutionPolicy Bypass -File "C:\path\to\script\toggle-theme.ps1"
type shortcut location

Now, type the name of your choice. In my case, I’m setting it as “Toggle Theme“. Click “Finish“.

name shortcut and click finish

That is it. From now on, whenever you want to switch the theme, simply double-click the shortcut. The theme switches instantly. Please note that your screen will briefly flash, the taskbar will disappear for a moment, and any open File Explorer Windows will close automatically.

desktop shortcut to switch between light and dark themes in Windows 11

Optional Steps – Change Shortcut Icon

By default, the shortcut uses the PowerShell icon as its icon. If you don’t like it, you can change it. To do that, right-click the shortcut and select “Properties”. Click the “Change Icon” button.

In this window, replace the current path in the “Look for icons in this file” field with the following path and press “Enter”.

%SystemRoot%\System32\imageres.dll

Now, choose the icon of your choice and click “OK”.

With that, you’ve changed the shortcut icon.

Wrapping Up — Switch Light and Dark Themes in Windows 11 Using a Desktop Shortcut

As you can see, if you are looking for a simple way to toggle between light and dark themes in Windows 11, creating a desktop shortcut is the best solution. If you prefer not to do it manually, you can also automatically switch between light and dark themes on a schedule.

If you have any questions or need help, comment below. I’ll be happy to assist.

Leave a Comment

Your email address will not be published. Required fields are marked *