Skip to content

Instantly share code, notes, and snippets.

@SamWolski
Last active March 30, 2021 09:43
Show Gist options
  • Save SamWolski/523dba0619375107238f165fb8f17470 to your computer and use it in GitHub Desktop.
Save SamWolski/523dba0619375107238f165fb8f17470 to your computer and use it in GitHub Desktop.
Check if Dark Mode is being used in macOS, using only python stdlib
import subprocess
def check_appearance():
"""Checks DARK (True)/LIGHT(False) mode of macos.
https://stackoverflow.com/a/65357166"""
cmd = 'defaults read -g AppleInterfaceStyle'
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True)
return bool(p.communicate()[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment