Bug 502682 - Compatibility with GTK symbolic icons (GTK icon recolorization)
Summary: Compatibility with GTK symbolic icons (GTK icon recolorization)
Status: REPORTED
Alias: None
Product: frameworks-kiconthemes
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Christoph Feck
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-11 15:06 UTC by Ilya Fedin
Modified: 2025-09-21 12:22 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Fedin 2025-04-11 15:06:40 UTC
SUMMARY
Being compatible with GTK's icon recolorization could made icon themes made primarily for GTK desktop environments way more usable in KDE. GTK also allows icons provided by applications to be recolored unlike KDE's way (since kiconthemes requires FollowColorScheme=true in index.theme which hicolor doesn't have) so various icons provided by applications could render better with this, too.

GTK uses `-symbolic` icon name ending as a sign the icon has to be recolored. By default, it recolors all elements with text color but if the element has one of the following classes:
* error
* warning
* success

They are recolored into the following colors accordingly:
* red
* orange
* green

The exact default values are: https://gitlab.gnome.org/GNOME/gtk/-/blob/a6792b83e33a4e2bc3143dd626b345f5c27d858c/gtk/gtkicontheme.c#L3862-3865

It seem to be themable using GTK themes though: https://gitlab.gnome.org/GNOME/gtk/-/blob/a6792b83e33a4e2bc3143dd626b345f5c27d858c/gtk/gtkcssstyle.c#L871

Here's how the classes are injected into SVG: https://gitlab.gnome.org/GNOME/gtk/-/blob/a6792b83e33a4e2bc3143dd626b345f5c27d858c/gtk/gdktextureutils.c#L208

They also seem to support recoloring PNG but not sure how much that's relevant for kiconthemes: https://gitlab.gnome.org/GNOME/gtk/-/blob/a6792b83e33a4e2bc3143dd626b345f5c27d858c/gtk/gtkicontheme.c#L2117

As a starting point, this could be enabled only when KDE's icon recolorization is not enabled, i.e. when the icon theme's index.theme doesn't have FollowsColorScheme=true

STEPS TO REPRODUCE
1. Use an icon theme made for GTK DEs or an application providing a symbolic icon made for GTK

OBSERVED RESULT
Icons are recolored as in GTK DEs

EXPECTED RESULT
Icons aren't recolored and look broken