Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toogle Light/Dark Mode Programmatically in Windows 11

I would like to toggle light / dark mode on Windows 11 programmatically.

Existing solutions are unsatisfactory:

  1. use the Registry values "AppsUseLightTheme" and "SystemUsesLightTheme". This worked perfectly in Windows 10. However, in Windows 11 the change is not applied in all places. For example, when switching to dark mode, Explorer windows are still light. And the clock text in the right corner of the Taskbar is still black, so now the clock cannot be read anymore.

  2. select a different Theme programmatically - however, this changes my Desktop background. I'd really just like to change the dark/light mode and keep everything else the same.

What's the best way to accomplish this?

like image 985
LTR Avatar asked May 30 '26 10:05

LTR


1 Answers

this is a little old topic but I'd like to share my (partial but ok I guess) solution:

create a couple of scheduled tasks:

Light theme

Program:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe    

Arguments:
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 1 -Type Dword -Force; New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 1 -Type Dword -Force; New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent -Name AccentColorMenu -Value 0 -Type Dword -Force; New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent -Name AccentColorMenu -Value 0xff1d3f58 -Type Dword -Force

Dark Theme

Program:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe    

Arguments:
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force; New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force; New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent -Name AccentColorMenu -Value 0 -Type Dword -Force; New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent -Name AccentColorMenu -Value 0xff1d3f58 -Type Dword -Force

Especially the following:

New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent -Name AccentColorMenu -Value 0 -Type Dword -Force; New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent -Name AccentColorMenu -Value 0xff1d3f58 -Type Dword -Force

allowed me to force the change of the taskbar from light to dark but apparently with a little quirk: the second display taskbar does not switch to the actual color but stays on the previous one, who knows why, on the primary display it works fine so if you have one display you should have no problem.

If anyone can help fixing this it would be nice

like image 188
Giovanni Augusto Avatar answered Jun 02 '26 08:06

Giovanni Augusto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!