🐍 Python 3.10+
Enable Dark Mode (Python)
Switches File Explorer and other system surfaces to dark mode. Applies the tweak via the stdlib winreg module.
set_dark_mode.py
#!/usr/bin/env python3
"""
set_dark_mode.py
Enable Dark Mode.
Switches File Explorer and other system surfaces to dark mode.
Usage:
python set_dark_mode.py
"""
import winreg
def main() -> None:
key = winreg.CreateKeyEx(
winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", 0, winreg.KEY_SET_VALUE
)
winreg.SetValueEx(key, "AppsUseLightTheme", 0, winreg.REG_DWORD, 0)
winreg.CloseKey(key)
print("Enable Dark Mode applied.")
if __name__ == "__main__":
main()