IJ 2019: set LookupElement text color



I'm creating a lookup element with LookupElementBuilder. I'd like to change its text color to red. I do that by calling:


This worked fine until IJ 2019. I think it stopped working due to a change in LookupCellRenderer.getListCellRendererComponent(..) line 161:

Color itemColor = isSelected ? SELECTED_FOREGROUND_COLOR : JBColor.namedColor("CompletionPopup.foreground", presentation.getItemTextForeground());

Looks like the color I set in the presentation is only used as a default.

Am I doing somethnig wrong or is there another way I should use to set the lookup element text color (preferably something that will also work in previous versions)? 


Could you please clarify exact IDE version you're using? Does it work if the item is currently _not_ selected?


This doesn't work with, for example, IntelliJ 2019.1 community edition, build #IC-191-6183-87.

I'm not sure with what version exactly it stopped working, but it does work with IntelliJ 2018.3 community edition, build #IC-183-4284.148

The items text is supposed to be red when the code completion popup opens (regardless if they are selected or not). When it works (e.g. with IJ 2018.3), the text appears red even when the item is not selected. When it doesn't work (e.g. with IJ 2019.1), the text is never red - selected or not.

See below image for a working example:


It should be fixed in later versions of 191, please try.



Thanks very much for your help.


Please sign in to leave a comment.