* Improved rich_echo, added rich_echo_via_pager * Initial implementation for #647, added rich output
20 lines
433 B
Python
20 lines
433 B
Python
"""Detect dark mode on MacOS >= 10.14"""
|
|
|
|
import objc
|
|
import Foundation
|
|
|
|
|
|
def theme():
|
|
with objc.autorelease_pool():
|
|
user_defaults = Foundation.NSUserDefaults.standardUserDefaults()
|
|
system_theme = user_defaults.stringForKey_("AppleInterfaceStyle")
|
|
return "dark" if system_theme == "Dark" else "light"
|
|
|
|
|
|
def is_dark_mode():
|
|
return theme() == "dark"
|
|
|
|
|
|
def is_light_mode():
|
|
return theme() == "light"
|