Skip to content

theme: add GTK3 selection colours so selected rows stay readable in Thunar etc#191

Open
kanikamaxxing wants to merge 1 commit into
Axenide:mainfrom
kanikamaxxing:fix/gtk-selection-contrast
Open

theme: add GTK3 selection colours so selected rows stay readable in Thunar etc#191
kanikamaxxing wants to merge 1 commit into
Axenide:mainfrom
kanikamaxxing:fix/gtk-selection-contrast

Conversation

@kanikamaxxing
Copy link
Copy Markdown

Summary

GtkGenerator writes only the libadwaita-flavoured colour variables (accent_color, accent_fg_color, window_bg_color, …). GTK3 apps like Thunar read a different set of names (theme_selected_bg_color, theme_selected_fg_color, theme_bg_color, theme_fg_color, theme_base_color, theme_text_color), so they fall back to whatever the underlying theme provides — on adw-gtk3 dark that leaves selected rows with the global view foreground (near-white) painted on top of the matugen accent colour (often a light pastel). Result: barely-readable selected entries in file listings.

Changes

modules/theme/GtkGenerator.qml (+20/-1):

  • Map theme_selected_bg_color / theme_selected_fg_color to accent_bg_color / accent_fg_color so GTK3 selection inherits the same dark-on-bright contrast libadwaita uses for GTK4.
  • Mirror theme_bg_color / theme_fg_color / theme_base_color / theme_text_color from the existing window/view variables for completeness.
  • Add an explicit *:selected, row:selected override so the contrast holds even when the underlying theme has its own row-style.

No behaviour change for GTK4 / libadwaita consumers — they already pick up the accent_* family unchanged.

Test plan

  • Open Thunar (GTK3) with a long file list, select a row — text is now readable on the matugen accent background instead of the near-white-on-pastel default.
  • Open a GTK4 / libadwaita app (Files, Settings) — selection still styled the same as before (accent_* unchanged).

— robin

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.
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.

1 participant