PowerShell: Set Dark Theme
Using PowerShell to set dark theme.
# set system pref to dark theme sp HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0
# set system pref to light theme sp HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 1
function xah-toggle-darktheme { # .DESCRIPTION # Toggle dark theme # Version 2022-01-15 # .LINK # http://xahlee.info/powershell/powershell_set_darktheme.html $xPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"; $xname = "AppsUseLightTheme" if ((gp $xPath -Name AppsUseLightTheme).$xname -eq 1) { sp $xPath -Name $xname -Value 0 } else { sp $xPath -Name $xname -Value 1 } }