I know this isn't kotlin specific, but: Is there ...
# intellij
d
I know this isn't kotlin specific, but: Is there a way to specify additional types/functions that represent colors, so that IntelliJ will render the color preview in the gutter like it does with CSS/java.awt.Color? I have some custom code that deals with colors, and it would be nice if the color preview worked with them.
a
I found a hack for this, but it's not ideal so I'd like to see an improvement.
Copy code
import org.intellij.lang.annotations.Language

fun Color.Companion.fromHex(
    @Language("css", prefix = "p { color: #", suffix = ";}")
    hex: String,
): Color = ...
👀 1
image.png
d
That is a very neat hack! Unfortunately, I'm not using strings, so I don't think it'll work.