mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DRYer
This commit is contained in:
parent
56c7f3e007
commit
b9d8e9c462
@ -889,8 +889,7 @@ def choose_files_and_remember_all_files(
|
||||
|
||||
def is_dark_theme():
|
||||
pal = QApplication.instance().palette()
|
||||
col = pal.color(QPalette.ColorRole.Window)
|
||||
return max(col.getRgb()[:3]) < 115
|
||||
return pal.is_dark_theme()
|
||||
|
||||
|
||||
def choose_osx_app(window, name, title, default_dir='/Applications'):
|
||||
|
@ -10,6 +10,13 @@ dark_color = QColor(45,45,45)
|
||||
dark_text_color = QColor('#ddd')
|
||||
|
||||
|
||||
def palette_is_dark(self):
|
||||
return self.color(QPalette.ColorRole.Window).lightnessF() < self.color(QPalette.ColorRole.WindowText).lightnessF()
|
||||
|
||||
|
||||
QPalette.is_dark_theme = palette_is_dark
|
||||
|
||||
|
||||
def fix_palette_colors(p):
|
||||
if iswindows:
|
||||
# On Windows the highlighted colors for inactive widgets are the
|
||||
|
Loading…
x
Reference in New Issue
Block a user