mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RUBY-5272 Find usages shouldn't use foreground attributes for elements in presentation
This commit is contained in:
@@ -29,6 +29,7 @@ import com.intellij.usages.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
@@ -131,6 +132,19 @@ class UsageViewTreeCellRenderer extends ColoredTreeCellRenderer {
|
||||
original = new SimpleTextAttributes(original.getStyle() | SimpleTextAttributes.STYLE_BOLD, original.getFgColor(), original.getWaveColor());
|
||||
}
|
||||
}
|
||||
// Fix problems with black background or white text as foreground
|
||||
// Logic of checking hsb component was taken from CssColorGutterRenderer
|
||||
if (original.getBgColor() != null){
|
||||
Color fgColor = original.getFgColor();
|
||||
if (fgColor != null){
|
||||
final float hsb[] = new float[3];
|
||||
Color.RGBtoHSB(fgColor.getRed(), fgColor.getGreen(), fgColor.getBlue(), hsb);
|
||||
if (hsb[2] > 0.7f){
|
||||
fgColor = null;
|
||||
}
|
||||
}
|
||||
return new SimpleTextAttributes(original.getStyle(), fgColor, original.getWaveColor());
|
||||
}
|
||||
return original;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user