Can someone write down a recipe how I could use my own symbolic icons as part of a theme? My goal is to use icons, that adapt to theme coloring (dark / light).
What worked so far
use glib-compile-resources to generate a resource.c/resource.h file.
As far as I can tell, gtk_icon_theme_has_icon() only checks for the exact icon name without fallbacks.
Good to know! Probably a good idea to add this to the docs, if it’s true.
Anyways, I edited my code, where I’m trying to make use of the icon. In the end, I don’t need _has_icon(). I just thought it’d make the code shorter.
It would also be better to use a valid icon theme path like scalable/actions instead of placing the icon the the toplevel
I have no idea how I would set something like that up. I’d say, because my resource file says prefix="/org/gjiten/", it should not be toplevel.
However, from your wording I infer, that this is not a necessity and can therefore be postponed.
However, the icon is still not color-theme-aware. Is there something I’m overseeing?
edit: I just discovered this passage in the docs:
[…] the icon loaded needs to […] use the “fg”, “success”, “warning” and “error” CSS styles in the SVG file itself.
I didn’t do that. I just used color #000000. Could this be the problem?
How do I solve this? Where would I set the css styles of the svg to fg ?
OT: Btw. I also figured out, that the call icon = gtk_image_new_from_icon_name ("aaaa", GTK_ICON_SIZE_DND); would only succeed, if the theme was received with gtk_icon_theme_get_default(). It would show a broken image, if the theme was created with gtk_icon_theme_new ()
All the informations to bundle and use your own symbolic icon (or ones that aren’t in adwaita-icon-theme like the icon-development-kit ones) are given in the Icon Library app, when you choose an icon there and choose to “include [it] in your application”.