diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java index dde3c506b8eb..71ee5f331c09 100644 --- a/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java +++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java @@ -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; }