I have an application. It ships with it’s own icons, which are installed to the ‘hicolor’ theme. All works great.
Lets say I want to allow users to apply a custom icon for this. They can make an alternative icon and put it in the appropriate location (eg ~/.local/share/icons/hicolor) and it will override the icons installed to the system (eg in /usr/share/icons/hicolor).
But, it seems like, so long as there is a PNG icon present in any of the 48x48 directories, the system chooses it. (Not certain about other resolutions) (edit: confirmed for 256x256 also)
This is kinda a shame, since KDE has nice features that revolve around using the SVG format (like symbolic icons that follow user colour schemes), and also, it’s much easier for a user to replace a single scalable file, than to need to statically generate a set of various different-sized PNG icons.
Also, it’s kinda confusing when no amount of custom icons overriding the stock ones, will be recognised, if this one icon is left without being overridden.
I’ve read pseudocode on freedesktop’s site that suggest that SVG should be preferred over PNG (obviously the pseudocode isn’t quite accurate) and I’ve seen posts suggesting that static PNGs are preferred for performance reasons, but also read the opposite… I’ve read a lot of docs and they either don’t mention this or don’t provide a clear answer.
Edit:
For an example from the official spec:
For example, installing a svg icon in $prefix/share/icons/hicolor/scalable/apps means most desktops will have one icon that works for all sizes.
but
This favours PNG first
for extension in ("png", "svg", "xpm") {
and
As soon as there is an icon of any size that matches in a theme, the search is stopped.
It also favours scaled icons last. And requires the 48x48 PNG:
Minimally you should install a 48x48 icon in the hicolor theme.
So I don’t see how to prefer the SVG like it says.
What’s the right way to deal with this? Is it an option (or, is it wise) to only ship SVG icons with the app? Is that portable to other modern DE? Is there a way to get the system to prefer the SVG icon? You get the idea. Any advice would be greatly appreciated!