mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
performance
This commit is contained in:
@@ -36,15 +36,10 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RainbowHighlighter {
|
||||
private final float[] myFloats;
|
||||
@NotNull private final TextAttributesScheme myColorsScheme;
|
||||
|
||||
public RainbowHighlighter(@Nullable TextAttributesScheme colorsScheme) {
|
||||
myColorsScheme = colorsScheme != null ? colorsScheme : EditorColorsManager.getInstance().getGlobalScheme();
|
||||
TextAttributes attributes = myColorsScheme.getAttributes(DefaultLanguageHighlighterColors.CONSTANT);
|
||||
Color foregroundColor = attributes.getForegroundColor();
|
||||
float[] components = foregroundColor.getRGBColorComponents(null);
|
||||
myFloats = Color.RGBtoHSB((int)(255 * components[0]), (int)(255 * components[0]), (int)(255 * components[0]), null);
|
||||
}
|
||||
|
||||
public static final HighlightInfoType RAINBOW_ELEMENT = new HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, DefaultLanguageHighlighterColors.CONSTANT);
|
||||
@@ -72,7 +67,7 @@ public class RainbowHighlighter {
|
||||
|
||||
final float colors = 36.0f;
|
||||
final float v = Math.round(Math.abs(colors * hash) / Integer.MAX_VALUE) / colors;
|
||||
return Color.getHSBColor(v, 0.7f, myFloats[2] + .3f);
|
||||
return Color.getHSBColor(v, 0.7f, .3f);
|
||||
}
|
||||
|
||||
public HighlightInfo getInfo(@Nullable String nameKey, @Nullable PsiElement id, @Nullable TextAttributesKey colorKey) {
|
||||
|
||||
Reference in New Issue
Block a user