Fix custom theme handling for Qt6

This commit is contained in:
Veronica Berglyd Olsen
2025-01-11 23:55:08 +01:00
parent ff7446a2ef
commit 27a0a47aaa
7 changed files with 50 additions and 17 deletions
+14
View File
@@ -304,6 +304,20 @@ class GuiTheme:
backCol = self._guiPalette.window().color()
textCol = self._guiPalette.windowText().color()
# Calculate Based on Qt Fusion
light = backCol.lighter(150)
mid = backCol.darker(130)
midLight = mid.lighter(110)
dark = backCol.darker(150)
shadow = dark.darker(135)
self._guiPalette.setColor(QPalette.ColorRole.Light, light)
self._guiPalette.setColor(QPalette.ColorRole.Mid, mid)
self._guiPalette.setColor(QPalette.ColorRole.Midlight, midLight)
self._guiPalette.setColor(QPalette.ColorRole.Dark, dark)
self._guiPalette.setColor(QPalette.ColorRole.Shadow, shadow)
# Calculate Help Text
backLNess = backCol.lightnessF()
textLNess = textCol.lightnessF()
self.isLightTheme = backLNess > textLNess