does anyone know where in the registry for a user the current solid desktop background color is set?
7 Answers
HKCU\Control Panel\Colors\Background
It's a string with a space between the numbers for red/green/blue, for instance for straight blue: "0 0 255"
- 116,404
- 13
- 187
- 256
You can change the desktop background for a user in the registry.
First remove the wallpaper, if there is one:
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v WallPaper /t REG_SZ /d " " /f
Then set you color. The values are in RGB so for example "255 0 0" would be red.
reg add "HKEY_CURRENT_USER\Control Panel\Colors" /v Background /t REG_SZ /d "0 66 117" /f
- 141
In Windows 10 1809, to set the wallpaper to Solid color: black (0 0 0)
:: BackgroundType: 0 -> Picture | 1 -> Solid color | 2 -> Slideshow
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers" /v BackgroundType /t REG_DWORD /d 1 /f
reg add "HKCU\Control Panel\Desktop" /v WallPaper /t REG_SZ /d "" /f
reg add "HKCU\Control Panel\Colors" /v Background /t REG_SZ /d "0 0 0" /f
Must logoff and login back to apply.
- 310
- 2
- 8
The changes on the registry are not applied immediately.
A better alternative would be to use the windows function SetSysColors in C++.
See this answer: https://stackoverflow.com/a/19849675/3844137
- 54
I changed my HKEY_CURRENT_USER\Control Panel\Desktop\Colors settings and later wanted to revert back to the original settings, but couldn't find the default colour codes. In case anyone finds it useful, here is a screenshot I made from another system showing the default colour values:
#!/usr/bin/env pwsh
#Requires -PSEdition 'Core'
#Requires -Version 7.6.0
#Requires -RunAsAdministrator
#Requires -Modules 'Microsoft.PowerShell.Management'
$Value = '0 0 0'
# For `#000000`, as an example.
If ($IsWindows) {
If ((Test-Path -LiteralPath 'HKCU:\Control Panel\Desktop') -NE $True) { New-Item 'HKCU:\Control Panel\Desktop' -Force -EA 'SilentlyContinue' }
If ((Test-Path -LiteralPath 'HKCU:\Control Panel\Colors') -NE $True) { New-Item 'HKCU:\Control Panel\Colors' -Force -EA 'SilentlyContinue' }
New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Desktop' -Name 'WallPaper' -Value '' -PropertyType 'String' -Force -EA 'SilentlyContinue'
New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Colors' -Name 'Background' -Value "$Value" -PropertyType 'String' -Force -EA 'SilentlyContinue'
}
