From 9a0ef52866fcea1a766e11ef5a8fc67a0dbbc7c7 Mon Sep 17 00:00:00 2001 From: robin <242058117+kanikamaxxing@users.noreply.github.com> Date: Sun, 24 May 2026 12:01:25 +0200 Subject: [PATCH] theme: add GTK3 selection colours + selected-row contrast override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ambxst's GtkGenerator wrote only the libadwaita-flavoured colour variables (accent_color, accent_fg_color, window_bg_color, etc.). GTK3 apps like Thunar read different variable names (theme_selected_bg_color, theme_selected_fg_color, theme_bg_color, theme_fg_color, theme_base_color, theme_text_color), so they fell back to the underlying theme's defaults — which on adw-gtk3 dark leaves selected rows with the global view foreground (white-ish) painted on top of the matugen accent colour (often a light pastel). The result was near-illegible selected entries in file listings. This change: - Adds theme_selected_bg_color and theme_selected_fg_color mapped to accent_bg_color / accent_fg_color so GTK3 selection picks up the same dark-on-bright contrast libadwaita gets for GTK4. - Mirrors theme_bg_color / theme_fg_color / theme_base_color / theme_text_color from the existing window/view variables for completeness. - Adds an explicit *:selected override for rows in views so the contrast holds regardless of any inherited row-style from the underlying theme. No behavioural change for GTK4 / libadwaita consumers — they already pick up the accent_* family unchanged. --- modules/theme/GtkGenerator.qml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/theme/GtkGenerator.qml b/modules/theme/GtkGenerator.qml index 95a4bb96a..c6f0a4597 100644 --- a/modules/theme/GtkGenerator.qml +++ b/modules/theme/GtkGenerator.qml @@ -36,13 +36,32 @@ QtObject { css += `@define-color card_bg_color ${surfaceContainer};\n` css += `@define-color card_fg_color ${onSurface};\n` - // Sidebar typically matches window or has slight contrast. + // Sidebar typically matches window or has slight contrast. // Using window variables as reference. css += `@define-color sidebar_bg_color @window_bg_color;\n` css += `@define-color sidebar_fg_color @window_fg_color;\n` css += `@define-color sidebar_border_color @window_bg_color;\n` css += `@define-color sidebar_backdrop_color @window_bg_color;\n` + // GTK3 selection colours — without these, GTK3 apps (Thunar, etc) fall back to + // the theme's defaults which often leave selected rows with white text on the + // light accent colour (very low contrast). Map them to accent_bg/_fg so selected + // rows get the same dark-on-bright contrast that libadwaita uses for GTK4. + css += `@define-color theme_selected_bg_color @accent_bg_color;\n` + css += `@define-color theme_selected_fg_color @accent_fg_color;\n` + css += `@define-color theme_bg_color @window_bg_color;\n` + css += `@define-color theme_fg_color @window_fg_color;\n` + css += `@define-color theme_base_color @view_bg_color;\n` + css += `@define-color theme_text_color @view_fg_color;\n` + + // Explicit selection styling override for views (file lists, tree views, etc) + // to force readable contrast regardless of theme defaults. + css += `\n` + css += `*:selected, *:selected:focus, row:selected, row:selected:focus {\n` + css += ` background-color: @accent_bg_color;\n` + css += ` color: @accent_fg_color;\n` + css += `}\n` + const home = Quickshell.env("HOME") const gtk3Dir = home + "/.config/gtk-3.0" const gtk4Dir = home + "/.config/gtk-4.0"