Change icons according to theme
Answered
Hi,
I want to set different icons for actions according to if it's a dark or light theme. Is it possible?
At the moment I'm defining the action's icons in the plugin.xml. Also, if there is a way to paint the icon according to the text color for svg/png (similarly to React) it can also do the trick.
Something similar to what is done for IntelliJ's add/edit configuration button could be great.
Thank you,
Shachar
Please sign in to leave a comment.
The API will handle default/dark and normal/HDPI 2x icons for you if you name your icon files according to the API convention.
Here I have one icon with variants for normal, dark, normal 2x and dark 2x:
The icon load is done on the normal 1x file the rest the API handles:
public static final Icon ABBREVIATION = load("/icons/application/abbreviation.png");I would point you to the documentation but I referred to it so long ago, I don't remember where exactly it is documented, but I know it is documented.
Thank you Vladimir, this was super helpful for me :)
Found the docs, putting here for future reference: http://www.jetbrains.org/intellij/sdk/docs/reference_guide/work_with_icons_and_images.html?search=icon#image-formats-and-naming-notations