How to make a custom tool window icon be contrasting when selected
Answered
If I use IconLoader.findIcon to read an svg icon for a tool window it is not highlighted to become contrasting

Please sign in to leave a comment.
Hi,
It's hard to tell what can be the reason in your case.
I suggest checking the tool_window code sample (see https://plugins.jetbrains.com/docs/intellij/code-samples.html).
I verified that the icon is rendered correctly in the New UI.
Hi Karol,
Thank you for your feedback.
In the code sample internal icon is used icon="AllIcons.Toolwindows.WebToolWindow". It is loaded using IconManager.getInstance().loadRasterizedIcon(path, AllIcons.class.getClassLoader(), cacheKey, flags).
But what if a user wants to load an icon from the svg file? IconLoader.findIcon doesn't work correctly. To use loadRasterizedIcon I need to specify cacheKey and flags. What are these arguments? How can I get them?
Hi,
Sorry for the late answer.
IconManager.getInstance().loadRasterizedIcon()
is internal, so it can't be used by third party plugins anyway.I moved an example icon (
webService.svg
andwebService_dark.svg
) from the intellij-community repository:https://github.com/JetBrains/intellij-community/tree/master/platform/icons/src/expui/javaee
and it works correctly out-of-the-box. I followed the steps from the SDK documentation:
https://plugins.jetbrains.com/docs/intellij/icons.html#organizing-icons
If it still doesn't work for you, please share your icon files.
Please also see this section: https://plugins.jetbrains.com/docs/intellij/icons.html#new-ui-icon-colors
Maybe your colors are not the same as listed in the table?
Hi,
Thank you for the svg example. It works. I compared it to our svg file built in inkscape and most probably the reason it didn't work is that we didn't not have "stroke" property in the path. At least now we know what to do to make it work.