From 895b4faca5a3c58ab3b46edc07bcf4bb76503772 Mon Sep 17 00:00:00 2001 From: Traben Date: Wed, 24 Sep 2025 13:08:04 +1000 Subject: [PATCH 1/2] personal style changes --- gradle.properties | 2 +- .../editor/PreprocessorSyntaxHighlight.kt | 26 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index b5c162c..727c583 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ plugin.group=org.polyfrost.sorbet.intelliprocessor plugin.name=IntelliProcessor -plugin.version=4.0.0 +plugin.version=4.0.0-traben-edit plugin.repository.url=https://github.com/Polyfrost/IntelliProcessor gradle.version=8.11.1 diff --git a/src/main/kotlin/org/polyfrost/intelliprocessor/editor/PreprocessorSyntaxHighlight.kt b/src/main/kotlin/org/polyfrost/intelliprocessor/editor/PreprocessorSyntaxHighlight.kt index bb15bdd..da1e7d2 100644 --- a/src/main/kotlin/org/polyfrost/intelliprocessor/editor/PreprocessorSyntaxHighlight.kt +++ b/src/main/kotlin/org/polyfrost/intelliprocessor/editor/PreprocessorSyntaxHighlight.kt @@ -24,16 +24,32 @@ import org.polyfrost.intelliprocessor.Scope import java.util.ArrayDeque import java.util.Locale -val BOLD_ATTRIBUTE = TextAttributes(null, null, null, null, java.awt.Font.BOLD) val SCHEME = EditorColorsManager.getInstance().globalScheme + +val COMMENT_COLOR = SCHEME.getAttributes(DefaultLanguageHighlighterColors.LINE_COMMENT).foregroundColor + +fun TextAttributes.fade(): TextAttributes { + this.foregroundColor = this.foregroundColor?.let { c -> + // fade halfway to comment colour + val r = c.red + (COMMENT_COLOR.red - c.red) / 2 + val g = c.green + (COMMENT_COLOR.green - c.green) / 2 + val b = c.blue + (COMMENT_COLOR.blue - c.blue) / 2 + java.awt.Color(r, g, b) + } + return this +} + +val BOLD_ATTRIBUTE = TextAttributes(null, null, null, null, java.awt.Font.BOLD) +val ITALIC_ATTRIBUTE = TextAttributes(null, null, null, null, java.awt.Font.ITALIC) + val DIRECTIVE_COLOR: TextAttributesKey = DefaultLanguageHighlighterColors.KEYWORD -val DIRECTIVE_ATTRIBUTES: TextAttributes = TextAttributes.merge(SCHEME.getAttributes(DIRECTIVE_COLOR), BOLD_ATTRIBUTE) +val DIRECTIVE_ATTRIBUTES: TextAttributes = TextAttributes.merge(SCHEME.getAttributes(DIRECTIVE_COLOR), ITALIC_ATTRIBUTE).fade() val DIRECTIVE_TYPE = HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, DIRECTIVE_COLOR) val IDENTIFIER_COLOR: TextAttributesKey = DefaultLanguageHighlighterColors.IDENTIFIER -val IDENTIFIER_ATTRIBUTES: TextAttributes = TextAttributes.merge(SCHEME.getAttributes(IDENTIFIER_COLOR), BOLD_ATTRIBUTE) +val IDENTIFIER_ATTRIBUTES: TextAttributes = TextAttributes.merge(SCHEME.getAttributes(IDENTIFIER_COLOR), BOLD_ATTRIBUTE).fade() val IDENTIFIER_TYPE = HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, IDENTIFIER_COLOR) val NUMBER_COLOR: TextAttributesKey = DefaultLanguageHighlighterColors.NUMBER -val NUMBER_ATTRIBUTES: TextAttributes = TextAttributes.merge(SCHEME.getAttributes(NUMBER_COLOR), BOLD_ATTRIBUTE) +val NUMBER_ATTRIBUTES: TextAttributes = TextAttributes.merge(SCHEME.getAttributes(NUMBER_COLOR), BOLD_ATTRIBUTE).fade() val NUMBER_TYPE = HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, NUMBER_COLOR) private val WHITESPACES_PATTERN = "\\s+".toRegex() @@ -206,7 +222,7 @@ class PreprocessorSyntaxHighlight(private val project: Project) : HighlightVisit val mergedAttr = highlighter.getTokenHighlights(lexer.tokenType!!) .fold(TextAttributes()) { acc, attr -> TextAttributes.merge(acc, SCHEME.getAttributes(attr)) - } + }.fade() holder.add( HighlightInfo.newHighlightInfo(HighlightInfoType.INJECTED_LANGUAGE_FRAGMENT) From 49f4643f095e54c7f68f54ebb3f99e22a64c8bc5 Mon Sep 17 00:00:00 2001 From: Traben Date: Wed, 24 Sep 2025 13:39:35 +1000 Subject: [PATCH 2/2] revert version diff --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 727c583..b5c162c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ plugin.group=org.polyfrost.sorbet.intelliprocessor plugin.name=IntelliProcessor -plugin.version=4.0.0-traben-edit +plugin.version=4.0.0 plugin.repository.url=https://github.com/Polyfrost/IntelliProcessor gradle.version=8.11.1