diff: remove shadows from separators

This commit is contained in:
Aleksey Pivovarov
2018-08-17 14:36:40 +03:00
parent 86706d60b4
commit e4c9216c48
3 changed files with 2 additions and 43 deletions
@@ -26,7 +26,6 @@ import com.intellij.openapi.editor.markup.LineMarkerRendererEx;
import com.intellij.openapi.editor.markup.LineSeparatorRenderer;
import com.intellij.openapi.ui.GraphicsConfig;
import com.intellij.openapi.util.BooleanGetter;
import com.intellij.ui.ColorUtil;
import com.intellij.ui.Gray;
import com.intellij.util.ui.GraphicsUtil;
import org.jetbrains.annotations.NotNull;
@@ -172,15 +171,12 @@ public class DiffLineSeparatorRenderer implements LineMarkerRendererEx, LineSepa
int height = getHeight(lineHeight);
if (scheme == null) scheme = EditorColorsManager.getInstance().getGlobalScheme();
g.setColor(getBackgroundColor(scheme));
Graphics2D gg = ((Graphics2D)g);
AffineTransform oldTransform = gg.getTransform();
for (int i = 0; i < height; i++) {
Color color = getTopBorderColor(i, lineHeight, scheme);
if (color == null) color = getBottomBorderColor(i, lineHeight, scheme);
if (color == null) color = getBackgroundColor(scheme);
gg.setColor(color);
gg.drawPolyline(xPoints, yPoints, xPoints.length);
gg.translate(0, 1);
}
@@ -192,8 +188,6 @@ public class DiffLineSeparatorRenderer implements LineMarkerRendererEx, LineSepa
//
public static final ColorKey BACKGROUND = ColorKey.createColorKey("DIFF_SEPARATORS_BACKGROUND");
public static final ColorKey TOP_BORDER = ColorKey.createColorKey("DIFF_SEPARATORS_TOP_BORDER");
public static final ColorKey BOTTOM_BORDER = ColorKey.createColorKey("DIFF_SEPARATORS_BOTTOM_BORDER");
private static int getStepSize(int lineHeight) {
return Math.max(lineHeight / 3, 1);
@@ -208,33 +202,4 @@ public class DiffLineSeparatorRenderer implements LineMarkerRendererEx, LineSepa
Color color = scheme.getColor(BACKGROUND);
return color != null ? color : Gray._128;
}
@Nullable
private static Color getTopBorderColor(int i, int lineHeight, @NotNull EditorColorsScheme scheme) {
int border = Math.max(lineHeight / 4, 1);
double ratio = (double)i / border;
if (ratio > 1) return null;
Color top = scheme.getColor(TOP_BORDER);
if (top == null) return null;
Color background = getBackgroundColor(scheme);
return ColorUtil.mix(top, background, ratio);
}
@Nullable
private static Color getBottomBorderColor(int i, int lineHeight, @NotNull EditorColorsScheme scheme) {
int height = getHeight(lineHeight);
int border = Math.max(lineHeight / 12, 1);
int index = (height - i - 1);
double ratio = (double)index / border;
if (ratio > 1) return null;
Color bottom = scheme.getColor(BOTTOM_BORDER);
if (bottom == null) return null;
Color background = getBackgroundColor(scheme);
return ColorUtil.mix(bottom, background, ratio);
}
}
@@ -74,8 +74,6 @@ public class DiffColorsPageFactory implements ColorAndFontPanelFactory, ColorAnd
List<ColorDescriptor> descriptors = new ArrayList<>();
descriptors.add(new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.vcs.diff.separator.background"), DiffLineSeparatorRenderer.BACKGROUND, ColorDescriptor.Kind.BACKGROUND));
descriptors.add(new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.vcs.diff.separator.top_border"), DiffLineSeparatorRenderer.TOP_BORDER, ColorDescriptor.Kind.BACKGROUND));
descriptors.add(new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.vcs.diff.separator.bottom_border"), DiffLineSeparatorRenderer.BOTTOM_BORDER, ColorDescriptor.Kind.BACKGROUND));
return ArrayUtil.toObjectArray(descriptors, ColorDescriptor.class);
}
@@ -33,8 +33,6 @@
<option name="IGNORED_DELETED_LINES_BORDER_COLOR" value="9f9f9f"/>
<option name="CONSOLE_BACKGROUND_KEY" value="ffffff" />
<option name="DIFF_SEPARATORS_BACKGROUND" value="D9D9D9"/>
<option name="DIFF_SEPARATORS_TOP_BORDER" value="C8C8C8"/>
<option name="DIFF_SEPARATORS_BOTTOM_BORDER"/>
<option name="FILESTATUS_ADDED" value="0a7700"/>
<option name="FILESTATUS_DELETED" value="616161"/>
@@ -1184,9 +1182,7 @@
<option name="SELECTION_FOREGROUND" value="" />
<option name="TEARLINE_COLOR" value="555555" />
<option name="WHITESPACES" value="505050" />
<option name="DIFF_SEPARATORS_TOP_BORDER" value="1E1E1E"/>
<option name="DIFF_SEPARATORS_BACKGROUND" value="232323"/>
<option name="DIFF_SEPARATORS_BOTTOM_BORDER" value="222222"/>
<option name="VISUAL_INDENT_GUIDE" value="3c3c3c"/>
<option name="FOLDED_TEXT_BORDER_COLOR" value="43474a"/>