This commit is contained in:
Kovid Goyal 2022-07-19 13:52:44 +05:30
parent 56c7f3e007
commit b9d8e9c462
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 2 deletions

View File

@ -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'):

View File

@ -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