I would like to toggle light / dark mode on Windows 11 programmatically.
Existing solutions are unsatisfactory:
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.
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?
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:
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With