Skip to content

Commit 5c3df31

Browse files
Simplify light or dark check, early return for pyqt5 since no color scheme support
1 parent 6b68bdd commit 5c3df31

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

runmanager/__main__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
)
7171
from labscript_utils.qtwidgets.outputbox import OutputBox
7272
import qtutils.icons
73+
from qtutils.qt import QT_ENV
7374

7475
GLOBAL_MONOSPACE_FONT = "Consolas" if os.name == 'nt' else "Ubuntu Mono"
7576

@@ -100,13 +101,15 @@ def log_if_global(g, g_list, message):
100101
logger.info(message)
101102

102103
def check_if_light_or_dark():
104+
105+
# pyqt5 defaults to light and doesn't have styleHints.colorScheme()
106+
if QT_ENV.lower() == 'pyqt5':
107+
return "light"
103108
style_hints = QtGui.QGuiApplication.styleHints()
104109
if style_hints.colorScheme() == Qt.ColorScheme.Dark:
105110
return "dark"
106-
elif style_hints.colorScheme() == Qt.ColorScheme.Light:
107-
return "light"
108111
else:
109-
return "unknown"
112+
return "light"
110113

111114

112115
def composite_colors(r0, g0, b0, a0, r1, g1, b1, a1):
@@ -672,7 +675,6 @@ class GroupTab(object):
672675
GLOBALS_ROLE_SORT_DATA = QtCore.Qt.UserRole + 2
673676
GLOBALS_ROLE_PREVIOUS_TEXT = QtCore.Qt.UserRole + 3
674677
GLOBALS_ROLE_IS_BOOL = QtCore.Qt.UserRole + 4
675-
# TODO: Do we default to light?
676678
if check_if_light_or_dark() == "light":
677679
COLOR_ERROR = '#F79494' # light red
678680
COLOR_OK = '#A5F7C6' # light green

0 commit comments

Comments
 (0)