Skip to content

feat: add built-in modern theme (light & dark) - #135

Merged
jorio merged 5 commits into
jorio:masterfrom
ciansen:master
Aug 19, 2026
Merged

feat: add built-in modern theme (light & dark)#135
jorio merged 5 commits into
jorio:masterfrom
ciansen:master

Conversation

@ciansen

@ciansen ciansen commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

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

vi-coded with claude

image image image

ciansen and others added 2 commits August 15, 2026 01:36
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>

@jorio jorio left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. In QComboBox pulldown menus, Fusion's rectangular frame seems to come through beneath your styled menu

  2. Menus and context menus want to be rounded but get a rectangular background (a different one from QComboBox pulldown menus)

  3. QComboBox and QSpinBox look partially unthemed, especially in light mode.

  4. QHintButton's icon is squished in PrefsDialog (the circled question marks). The icon must be at least 16x16. Remove internal padding for QHintButton?

  5. Sidebar: the selection background's "pill style" looks like it has a dent on all top-level items.

  6. In light mode, "default" push buttons are darker, so the icon should be white.

  7. Tab close buttons are completely invisible unless hovered.

Comment thread gitfourchette/assets/style-modern.qss Outdated
Comment thread gitfourchette/assets/style-modern.qss Outdated
Comment thread gitfourchette/assets/style-modern.qss Outdated
Comment thread gitfourchette/assets/style-modern.qss Outdated
Comment thread gitfourchette/application.py Outdated
Comment thread gitfourchette/application.py Outdated
if themeColors is not None:
self.setPalette(themes.buildPalette(themeColors))
else:
self.setPalette(self.platformDefaultPalette)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't tested yet, can you test it?

Comment thread gitfourchette/settings.py Outdated
Comment thread gitfourchette/forms/contextheader.py Outdated
Comment thread gitfourchette/application.py
Comment thread gitfourchette/themes.py
@jorio

jorio commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Do you mean like, having a QT-Style "Checkbox" only? For this case we need to specify a base design like Fusion.
Did I understand that correctly? Or just want me to change inside code without changing UI?

Conceptually, your theme is mutually exclusive with native Qt styles (Breeze, Oxygen, etc.) because it needs Fusion to work properly.

So, I think the appTheme setting should go, and the qtStyle setting should be overloaded to be able to set one of your themes.

You could use some magic prefix to specify whether a qtStyle value represents a native Qt style or one of your custom themes.

Does that sound sensible?

@ciansen
ciansen requested a review from jorio August 15, 2026 13:37
@jorio
jorio merged commit 8a8d5df into jorio:master Aug 19, 2026
6 checks passed
@jorio

jorio commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Thank you for your contribution!
I added a few tweaks of my own and I'll ship the new themes in the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants