Skip to content

Commit ca7e84d

Browse files
authored
fix(ui): use consistent dark mode colors for all systems (#752)
1 parent e0d21c1 commit ca7e84d

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tagstudio/src/qt/ts_qt.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
from PySide6.QtCore import QObject, QSettings, Qt, QThread, QThreadPool, QTimer, Signal
2626
from PySide6.QtGui import (
2727
QAction,
28+
QColor,
2829
QDragEnterEvent,
2930
QDragMoveEvent,
3031
QDropEvent,
3132
QFontDatabase,
3233
QGuiApplication,
3334
QIcon,
3435
QMouseEvent,
36+
QPalette,
3537
)
3638
from PySide6.QtUiTools import QUiLoader
3739
from PySide6.QtWidgets import (
@@ -244,6 +246,18 @@ def start(self) -> None:
244246
app.setStyle("Fusion")
245247
icon_path = Path(__file__).parents[2] / "resources/icon.png"
246248

249+
if QGuiApplication.styleHints().colorScheme() is Qt.ColorScheme.Dark:
250+
pal: QPalette = app.palette()
251+
pal.setColor(QPalette.ColorGroup.Normal, QPalette.ColorRole.Window, QColor("#1e1e1e"))
252+
pal.setColor(QPalette.ColorGroup.Normal, QPalette.ColorRole.Button, QColor("#1e1e1e"))
253+
pal.setColor(QPalette.ColorGroup.Inactive, QPalette.ColorRole.Window, QColor("#232323"))
254+
pal.setColor(QPalette.ColorGroup.Inactive, QPalette.ColorRole.Button, QColor("#232323"))
255+
pal.setColor(
256+
QPalette.ColorGroup.Inactive, QPalette.ColorRole.ButtonText, QColor("#666666")
257+
)
258+
259+
app.setPalette(pal)
260+
247261
# Handle OS signals
248262
self.setup_signals()
249263
# allow to process input from console, eg. SIGTERM

0 commit comments

Comments
 (0)