From dfa0ca1192ff69db71b67b53385100dc4c5baeda Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Tue, 20 Nov 2018 19:22:36 +0300 Subject: [PATCH] Some better colours for unmatched elements (KT-18089) Platform requires a single color for both selected/not-selected item and so colour selection isn't easy (see https://youtrack.jetbrains.com/issue/IDEA-191959 for details) #IDEA-191959 Fixed --- .../kotlin/idea/completion/LookupElementFactory.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupElementFactory.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupElementFactory.kt index 3a0636d0ca5..eaa896b2398 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupElementFactory.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupElementFactory.kt @@ -21,7 +21,7 @@ import com.intellij.codeInsight.completion.InsertionContext import com.intellij.codeInsight.lookup.LookupElement import com.intellij.codeInsight.lookup.LookupElementDecorator import com.intellij.codeInsight.lookup.LookupElementPresentation -import com.intellij.codeInsight.lookup.impl.LookupCellRenderer +import com.intellij.ui.JBColor import com.intellij.util.SmartList import org.jetbrains.kotlin.builtins.isBuiltinFunctionalType import org.jetbrains.kotlin.builtins.isFunctionType @@ -272,6 +272,8 @@ class LookupElementFactory( return element } + private val castRequiredColor = JBColor(0x4E4040, 0x969696) + private fun LookupElement.boldIfImmediate(weight: CallableWeight?): LookupElement { val style = when (weight?.enum) { CallableWeightEnum.thisClassMember, CallableWeightEnum.thisTypeExtension -> Style.BOLD @@ -286,7 +288,7 @@ class LookupElementFactory( presentation.isItemTextBold = true } else { - presentation.itemTextForeground = LookupCellRenderer.getGrayedForeground(false) + presentation.itemTextForeground = castRequiredColor // gray all tail fragments too: val fragments = presentation.tailFragments presentation.clearTail()