FileIconProvider return icon based IDE theme

Hello

I created a plugin to change my new file-type icons with success.

Now, I want to identify the IDE theme on getIcon (Dark/light mode) and return an appropriate icon.
How can I get the IDE theme mode?


override fun getIcon(file: VirtualFile, flags: Int, project: Project?): Icon? {
if (!isAvailable(file)) {
return null;
}
//TODO Identify IDE theme and return appropreate icon
return MyIcons.FileTypeLight;
}

object MyIcons {
@JvmField
val FileTypeLight = IconLoader.getIcon("/icons/light.svg", javaClass)
val FileTypeDark = IconLoader.getIcon("/icons/dark.svg", javaClass)
}
0

Please sign in to leave a comment.