From 9d50e774b90ec49eb148e12bf616c9f9bf8ed0d2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 8 Dec 2019 08:04:26 +0530 Subject: [PATCH] Only enable dark mode palette when using calibre style since it does not work with the system style Also dont disable alternating row colors with dark palettes on windows, since we can control the color. --- src/calibre/gui2/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 4712550eb1..f788833486 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1032,15 +1032,15 @@ class Application(QApplication): self.set_palette(p) def setup_styles(self, force_calibre_style): - if iswindows and windows_is_system_dark_mode_enabled(): - self.set_dark_mode_palette() - if iswindows or isosx: using_calibre_style = gprefs['ui_style'] != 'system' else: using_calibre_style = os.environ.get('CALIBRE_USE_SYSTEM_THEME', '0') == '0' if force_calibre_style: using_calibre_style = True + if iswindows and windows_is_system_dark_mode_enabled() and using_calibre_style: + self.set_dark_mode_palette() + self.using_calibre_style = using_calibre_style if DEBUG: prints('Using calibre Qt style:', self.using_calibre_style) @@ -1055,8 +1055,9 @@ class Application(QApplication): pal = self.palette() # dark blue is unreadable when using dark backgrounds pal.setColor(pal.Link, QColor('#6CB4EE')) - # alternating row colors look awful in most dark mode themes - pal.setColor(pal.AlternateBase, pal.color(pal.Base)) + if isosx: + # alternating row colors look awful in most dark mode themes + pal.setColor(pal.AlternateBase, pal.color(pal.Base)) if isosx and self.using_calibre_style: # Workaround for https://bugreports.qt.io/browse/QTBUG-75321 # Buttontext is set to black for some reason @@ -1064,6 +1065,7 @@ class Application(QApplication): self.set_palette(pal) def set_palette(self, pal): + self.is_dark_mode_palette = False self.ignore_palette_changes = True self.setPalette(pal) # Needed otherwise Qt does not emit the paletteChanged signal when