HighlightInfo (@NotNull PsiVariable variable, @NotNull PsiElement elementToHighlight, @NotNull TextAttributesScheme colorsScheme) { HighlightInfoType varType = getVariableNameHighlightType(variable, elementToHighlight); if (varType == null) { return null; } if (variable instanceof PsiField) { TextAttributes attributes = mergeWithScopeAttributes(variable, varType, colorsScheme); if (elementToHighlight.getParent() instanceof PsiReferenceExpression) { attributes = mergeWithVisibilityAttributes(variable, attributes, colorsScheme); } HighlightInfo.Builder builder = nameBuilder(varType).range(elementToHighlight); if (attributes != null) { builder.textAttributes(attributes); } return builder.createUnconditionally(); } HighlightInfo.Builder builder = nameBuilder(varType).range(elementToHighlight); return RainbowHighlighter.isRainbowEnabledWithInheritance(colorsScheme, JavaLanguage.INSTANCE) ? builder.createUnconditionally() : builder.create(); }