Add custom SVG icon?

I’ve been trying to add custom SVG icons to the toolbar for a couple of macros, but no matter how I save them from Inkscape LO doesn’t recognize them.

I thought since you can now use SVG icon themes that this would be possible, and SVG is one of the options in the import dialog, but they produce an error saying LO does not understand the format.

Is this possible? If not, is a 24×24 PNG really the optimal format? If I use a higher resolution, it seems to get rescaled and the transparency is replaced by white which looks odd.

Actually after further experimentation I can’t even get PNG icons to stick. They appear to import, but later they appear blank in the selection dialog and the toolbar items revert to text.

Edit: this seems true for built-in icons as well. They appear to change, but after a restart the toolbar reverts to text.

There are bug reports about that:

#tfd137623
#tdf136218
#tdf135681

and I can confirm the issue from own experience.

Whenever you add an icon, you cannot do it in “Automatic” mode of Tools > Options > LibreOffice > View > Icon Size. You have the set the icon size explicitly and then add an icon in the corresponding size. Then back and the next icon size and and icon in the corresponding size. Only after that, you can switch back to “Automatic”.

i have set the Icon Size to Large and added an 24x24 png file. but this did not work out at all. just the text appears after a restart

@s-light: And you are sure your LibreOffice uses “Large”? Try to add for each size an icon.

How are you supposed to know what these sizes mean? What is Large?

Currently (LO 7.1.0.3) I can’t even temporarily add an icon. They always appear blank in the dialog box. It’s not clear how you can remove them either.

Also, although some of those bug reports say the disappearing icon one is fixed, I still have it. I just added Alt Search and assigned it the SAME icon as regular Search & Replace. After restarting it’s vanished and reverted to text.