Cool - thank you for this helpful and working input, Giovanni Augusto (2024-09-21)!
For some reason I cannot comment on your comment, but only on OP...
ChatGPT made it into a toggle-PowerShell-Script for me:
# Toggle Light / Dark Mode Script
# Define registry paths
$personalizePath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"
$accentPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent"
# Read current system theme (SystemUsesLightTheme)
try {
$currentSystemTheme = Get-ItemPropertyValue -Path $personalizePath -Name SystemUsesLightTheme
} catch {
# If the registry entry is missing, default to Light
$currentSystemTheme = 1
New-ItemProperty -Path $personalizePath -Name SystemUsesLightTheme -Value $currentSystemTheme -Type Dword -Force
New-ItemProperty -Path $personalizePath -Name AppsUseLightTheme -Value $currentSystemTheme -Type Dword -Force
}
# Toggle logic
if ($currentSystemTheme -eq 1) {
# Currently Light → switch to Dark
$newValue = 0
Write-Host "Switching to Dark Mode..."
} else {
# Currently Dark → switch to Light
$newValue = 1
Write-Host "Switching to Light Mode..."
}
# Set System & Apps theme
New-ItemProperty -Path $personalizePath -Name SystemUsesLightTheme -Value $newValue -Type Dword -Force
New-ItemProperty -Path $personalizePath -Name AppsUseLightTheme -Value $newValue -Type Dword -Force
# Set Accent color (kept constant)
New-ItemProperty -Path $accentPath -Name AccentColorMenu -Value 0 -Type Dword -Force
New-ItemProperty -Path $acce