In IntelliJ there's a feature where you can preview colors in the gutter for regular rgb colors using the Color class. However, there are some cases where I prefer the HSL color model, which Java doesn't have, so I made my own class that extends Color. Colors instantiated through the custom class don't have previews; is there any way I can tell IntelliJ how to extract a preview from my class?

Here's a short preview of the HSLColor class:
public class HSLColor extends Color
{
private float[] hsl;
private float alpha;
public HSLColor(float h, float s, float l, float a)
{
this(toRGB(h, s, l, a));
hsl = new float[]{h, s, l};
alpha = a;
}
private HSLColor(float[] rgba)
{
super(rgba[0], rgba[1], rgba[2], rgba[3]);
}
}
It's not possible without modifying IDE source code or creating a custom plug-in.
Either submit a feature request, or write your own plug-in for that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With