How can I use Python to navigate Windows 10 UI to change a specific setting?


What I want to do is create a script that allows me to toggle Windows 10 clear and dark mode without having to manually go to settings every time, which requires 4 or 5 steps.

I’ve been looking at the os module but haven’t found a method that would let me navigate the task bar or the notifications center to access the settings from there, nor have I found a way to change that setting from a folder using basic Windows Explorer navigation.

The process would be to open the settings, navigate to the colors setting and toggle the color. Or do it by altering some file on the Windows folder for example, that would change that setting without opening the settings window.


I don’t think there is a python library that can tweak Windows UI settings (e.g: colors, mode, ..). However, to enable the dark mode in your Windows 10, you can use the python built-in module subprocess to execute a registry command and set the value of the keys AppsUseLightTheme and SystemUsesLightTheme to 0.

enter image description here



With Python, try this :

import subprocess

dark_app_mode = ['reg.exe', 'add', 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 
           '/v', 'AppsUseLightTheme', '/t', 'REG_DWORD', '/d', '0', '/f']
dark_windows_mode = ['reg.exe', 'add', 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', 
           '/v', 'SystemUsesLightTheme', '/t', 'REG_DWORD', '/d', '0', '/f']

Or this :

from subprocess import Popen

dark_app_mode = 'reg.exe add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize /v AppsUseLightTheme /t REG_DWORD /d 0 /f'
dark_windows_mode = 'reg.exe add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize /v SystemUsesLightTheme /t REG_DWORD /d 0 /f'

commands = [dark_app_mode, dark_windows_mode]

processes = [Popen(cmd, shell=True) for cmd in commands]


This will set a FULL dark mode in your Windows 10 (or 11) :

enter image description here

Answered By – abokey

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published