From 535a3b03a34a97c25249c605271a344cddc7fc41 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Fri, 23 Oct 2026 23:26:55 +1300 Subject: [PATCH 1/2] Fix white menu and toolbar text with a light custom color on dark Windows With Windows in dark mode and a light color chosen in place of the system colors, the Windows 11 style kept drawing menu bar and toolbar text in white: it takes those colors from the system color scheme, not from the palette (issue #1591). Request the color scheme that matches the chosen color before setting the palette, and go back to the system scheme with the system colors. On macOS, the scheme-change handler now leaves a custom color alone instead of replacing it with the system palette. Co-Authored-By: Claude Opus 5.5 --- sources/qetapp.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 90523beee..6f1197f89 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -1924,6 +1924,10 @@ void QETApp::invertMainWindowVisibility(QWidget *window) { false pour utiliser celles du theme en cours */ void QETApp::useSystemPalette(bool use) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) + // Follow the system light/dark setting again (see useCustomPalette()). + qApp->styleHints()->unsetColorScheme(); +#endif // The base palette is always initial_palette_ (see initStyle()); the // setting only decides whether the user's style.css is layered on top. qApp->setPalette(initial_palette_); @@ -2018,6 +2022,15 @@ void QETApp::useCustomPalette(const QColor &color) { p.setColor(QPalette::Disabled, QPalette::Text, disabled_text); p.setColor(QPalette::Disabled, QPalette::ButtonText, disabled_text); +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) + // Tell the style whether the chosen color is light or dark. Some + // styles draw part of their text from the system color scheme, not + // from the palette: the Windows 11 style keeps white menu bar and + // toolbar text on a light custom color when Windows is in dark + // mode (issue #1591). + qApp->styleHints()->setColorScheme(dark ? Qt::ColorScheme::Dark + : Qt::ColorScheme::Light); +#endif qApp->setPalette(p); qApp->setStyleSheet(QString()); @@ -2920,11 +2933,16 @@ void QETApp::initStyle() { if (!QET::Palette::styleIsFusion(qApp->style())) return; + QSettings settings; + // A custom color keeps its palette whatever the OS does; it also + // requests its own color scheme, which lands here too. + if (!settings.value("usesystemcolors", true).toBool() + && settings.contains("customapplicationcolor")) + return; initial_palette_ = scheme == Qt::ColorScheme::Dark ? QET::Palette::fusionDark() : QET::Palette::fusionLight(); applyIconTheme(initial_palette_); - QSettings settings; useSystemPalette(settings.value("usesystemcolors", true).toBool()); }); #endif From f3e7bff4ad8cf4892a02b1b3533db52dcfd3b9db Mon Sep 17 00:00:00 2001 From: ispyisail Date: Sat, 24 Oct 2026 06:05:26 +1300 Subject: [PATCH 2/2] Switch the icons back when the system colors are chosen again Choosing a custom color switches to the icon set that suits it, but ticking "use system colors" again kept that set until the next start: after a light color, the dark system theme showed dark icons on dark menus (issue #1591, second report). Co-Authored-By: Claude Opus 5.5 --- sources/qetapp.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 6f1197f89..286166da6 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -1931,6 +1931,8 @@ void QETApp::useSystemPalette(bool use) { // The base palette is always initial_palette_ (see initStyle()); the // setting only decides whether the user's style.css is layered on top. qApp->setPalette(initial_palette_); + // A custom color may have switched the icon theme; switch it back. + applyIconTheme(initial_palette_); if (use) { // Drop any stylesheet previously loaded from style.css: with system // colors requested, the palette set just above is what provides them.