We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a6e49d5 commit 57e2f60Copy full SHA for 57e2f60
guidata/qthelpers.py
@@ -118,11 +118,10 @@ def is_dark_theme() -> bool:
118
Returns:
119
True if dark mode is enabled
120
"""
121
- try:
122
- mode = os.environ[ENV_COLOR_MODE].lower()
123
- return mode == "dark" or (mode == "auto" and darkdetect.isDark())
124
- except KeyError:
125
- return darkdetect.isDark()
+ mode = os.environ.get(ENV_COLOR_MODE, "auto").lower()
+ if mode == "auto":
+ os.environ[ENV_COLOR_MODE] = mode = "dark" if darkdetect.isDark() else "light"
+ return mode == "dark"
126
127
128
def get_color_theme() -> Literal["light", "dark"]:
0 commit comments