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
Adam S
09/21/2024, 7:43 AM
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
Adam S
09/21/2024, 7:47 AM
image.png
d
Daniel Pitts
09/21/2024, 2:40 PM
That is a very neat hack! Unfortunately, I'm not using strings, so I don't think it'll work.