TagIconAndText (@Nullable PsiElement element) { Collection<TagManager.Tag> tags = getElementTags(element); ColoredText.Builder ct = ColoredText.builder(); Icon tagIcon = null; for (TagManager.Tag tag : tags) { if (tagIcon == null) tagIcon = tag.icon; if (tag.text.isEmpty()) continue; ct.append( tag.text + " ", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES.derive(SimpleTextAttributes.STYLE_BOLD, tag.color, null, null) ); } return new TagIconAndText(tagIcon, ct.build()); }