Icon rendered in Inlay not transparent
Answered
I have got following Kotlin code that puts an inlay with one of two images based on a condition into the editor. The icons themselves for testing are Intellijs own Commit Action Icon and General Error Icons. Both are transparent and SVGs. Yet with following Kotlin code:
private fun applyOnEditor(editor: Editor) {
val vs = FileDocumentManager.getInstance().getFile(editor.document) ?: return
val path = vs.path
val info = myHighlighting[path] ?: return
myActiveInlays.plusAssign(info.branchInfo.map { (startPos, steppedIn, skipped) ->
editor.inlayModel.addInlineElement(
editor.logicalPositionToOffset(startPos),
PresentationRenderer(
IconPresentation(
if (steppedIn && skipped) AllIcons.Actions.Commit else AllIcons.General.Error,
editor.contentComponent
)
)
)
})
}
I get the following output:
Is this a bug or am I doing something wrong for the background to be black and not transparent?
Tested in a plugin for CLion 2019.2.3
Please sign in to leave a comment.
Hello!
Yes, it is indeed bug, as we actually didn't use this presentation in our codebase, it wasn't properly tested. I'll do a fix today.
As a workaround for now you can create your own IconPresentation with the following content: