feat: add built-in modern theme (light & dark) - #135
Conversation
Ship a flat, roomy look that doesn't depend on the desktop's widget style, so the app looks consistent everywhere instead of inheriting whatever Breeze/Adwaita/Fusion happens to provide. New "Theme" setting in General: Modern (follow system), Modern Light, Modern Dark, or Desktop environment for the previous behavior. Defaults to Modern; unit tests keep the desktop look so pixel-precise tests aren't at the mercy of our own metrics. * themes.py: color tokens, QPalette and stylesheet construction * assets/style-modern.qss: stylesheet template fed by those tokens * Theme forces the Fusion style and can be switched without a restart * ContextHeader: use theme colors instead of a translucent white overlay
themes.py and style-modern.qss were committed with mode 100755, which trips ruff's EXE002 (executable file without a shebang). ruff runs before mypy and the tests in every CI matrix config, so this failed all six test jobs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Nice! Looks good and solves a real problem - Integration of Qt apps in GNOME et al is messy, so I understand the need to easily set a dark palette from within the app.
Can we unify the setting into Prefs.qtStyle? So that there's a single dropdown for the native Qt styles plus your themes.
Visual "bugs" I noticed:
-
In QComboBox pulldown menus, Fusion's rectangular frame seems to come through beneath your styled menu
-
Menus and context menus want to be rounded but get a rectangular background (a different one from QComboBox pulldown menus)
-
QComboBox and QSpinBox look partially unthemed, especially in light mode.
-
QHintButton's icon is squished in PrefsDialog (the circled question marks). The icon must be at least 16x16. Remove internal padding for QHintButton?
-
Sidebar: the selection background's "pill style" looks like it has a dent on all top-level items.
-
In light mode, "default" push buttons are darker, so the icon should be white.
-
Tab close buttons are completely invisible unless hovered.
| if themeColors is not None: | ||
| self.setPalette(themes.buildPalette(themeColors)) | ||
| else: | ||
| self.setPalette(self.platformDefaultPalette) |
There was a problem hiding this comment.
I wonder if setPalette(QPalette()) would work to reset the palette? (I haven't tried!)
If this works, this would fix the case where we restore a stale palette if the user changes their system palette while the app is open.
There was a problem hiding this comment.
Didn't tested yet, can you test it?
Conceptually, your theme is mutually exclusive with native Qt styles (Breeze, Oxygen, etc.) because it needs Fusion to work properly. So, I think the You could use some magic prefix to specify whether a Does that sound sensible? |
|
Thank you for your contribution! |
Ship a flat, roomy look that doesn't depend on the desktop's widget style, so the app looks consistent everywhere instead of inheriting whatever Breeze/Adwaita/Fusion happens to provide.
New "Theme" setting in General: Modern (follow system), Modern Light, Modern Dark, or Desktop environment for the previous behavior. Defaults to Modern; unit tests keep the desktop look so pixel-precise tests aren't at the mercy of our own metrics.
vi-coded with claude