mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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.
This commit is contained in:
parent
9d8ad144ff
commit
9d50e774b9
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user