Last active
March 30, 2021 09:43
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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