I am aware that with ctypes.windll.user32.SystemParametersInfoW(20, 0, pathToImage, 3)
I can change the wallpaper image and by setting the pathToImage
to an empty string I would effectively have no image as wallpaper, thus I will see the solid background color.
My question is, How to change the solid background color?
Further investigating the Windows API. I found IDesktopWallpaper setbackgroundcolor() method which sounds like something that I need. However, I am not aware how to call/use it via python or command line.
Instead of using IDesktopWallpaper, it is more simpler to use SetSysColors (from winuser.h
header).
In Python, the code would look like this:
import ctypes
from ctypes.wintypes import RGB
from ctypes import byref, c_int
def changeSystemColor(color)
ctypes.windll.user32.SetSysColors(1, byref(c_int(1)), byref(c_int(color)))
if __name__ == '__main__':
color = RGB(255, 0, 0) # red
changeColor(color)
As stated in your post, you can do ctypes.windll.user32.SystemParametersInfoW(20, 0, "", 3)
to remove the wallpaper image, exposing the solid background color that you can set with ctypes.windll.user32.SetSysColors
.