I’m trying to port a custom widget of Evince to gtk4. In fact the gtk3 version of this widget use @theme_selected_bg_color to color the text selection. The Adwaita theme of libadwaita simply renamed this named color to @accent_bg_color but the Default theme of gtk4 still use the old one. Evince is a user of libadwaita, so I can’t access @theme_selected_bg_color any more. What should I do to maintain the compatibility to the Default theme of gtk4?
You don’t need to maintain compatibility with the “Default” named GTK 4 theme because libadwaita will make it choose its Adwaita theme automatically, effectively bypassing the theme with the “Default” name.
That is what I mean. I found that applications linked with libadwaita are forced to use the Adwaita theme. My concern is that there is one different named color between Adwaita and Default. What should I to do to deal with the case when Evince is running under a desktop environment with custom Gtk theme which conform to the Default theme.
When GNOME 42 is released with most apps ported over to libadwaita and GTK 4 (hopefully at least), third-party GTK 4 themes will be expected to support the named colors (and accent colors). As such support for both Adwaita and Default is not something I’d strive for. GTK 3 and GTK 4 themes aren’t really compatible anyway, so theme makers will need to account for libadwaita/Adwaita if they want to get their theme working correctly with those apps when creating or porting their theme.