Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@imhemish
Last active May 14, 2021 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imhemish/d04c57025ce8dd3d76a1b042ce65ab9a to your computer and use it in GitHub Desktop.
Save imhemish/d04c57025ce8dd3d76a1b042ce65ab9a to your computer and use it in GitHub Desktop.
win10-toggle-theme
# Python3
# Double click this file to change app mode theme in Windows 10
# Dark theme is 0 and light theme is 1
import os
import subprocess
themecolour = int(os.popen("reg query HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize /v AppsUseLightTheme").read().rstrip()[-1])
changedtheme = str(int(not bool(themecolour)))
command = ['reg.exe', 'add', 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize',
'/v', 'AppsUseLightTheme', '/t', 'REG_DWORD', '/d', changedtheme, '/f']
subprocess.call(command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment