Bug 502682

Summary: Compatibility with GTK symbolic icons (GTK icon recolorization)
Product: [Frameworks and Libraries] frameworks-kiconthemes Reporter: Ilya Fedin <fedin-ilja2010>
Component: generalAssignee: Christoph Feck <cfeck>
Status: REPORTED ---    
Severity: wishlist CC: 4wy78uwh, kdelibs-bugs-null
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

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