-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
771 additions
and
365 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
"""Detect dark mode on MacOS >= 10.14""" | ||
"""Detect dark mode on MacOS >= 10.14 or fake it elsewhere""" | ||
|
||
import objc | ||
import Foundation | ||
from osxphotos.utils import is_macos | ||
|
||
|
||
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" | ||
if is_macos: | ||
import objc | ||
import Foundation | ||
|
||
|
||
def is_dark_mode(): | ||
return theme() == "dark" | ||
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_light_mode(): | ||
return theme() == "light" | ||
def is_dark_mode(): | ||
return theme() == "dark" | ||
|
||
|
||
def is_light_mode(): | ||
return theme() == "light" | ||
else: | ||
def theme(): | ||
return "light" | ||
|
||
|
||
def is_dark_mode(): | ||
return theme() == "dark" | ||
|
||
|
||
def is_light_mode(): | ||
return theme() == "light" |
This file contains 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
Oops, something went wrong.