Skip to content

Commit

Permalink
Add ability to change a color of a separator line between editor and …
Browse files Browse the repository at this point in the history
…breadcrumbs
  • Loading branch information
Sergey Malenkov committed May 17, 2017
1 parent 7f516fa commit dda1191
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public interface EditorColors {

ColorKey TEARLINE_COLOR = ColorKey.createColorKey("TEARLINE_COLOR");
ColorKey SELECTED_TEARLINE_COLOR = ColorKey.createColorKey("SELECTED_TEARLINE_COLOR");
ColorKey SEPARATOR_ABOVE_COLOR = ColorKey.createColorKey("SEPARATOR_ABOVE_COLOR");
ColorKey SEPARATOR_BELOW_COLOR = ColorKey.createColorKey("SEPARATOR_BELOW_COLOR");
@Deprecated ColorKey FOLDING_TREE_COLOR = TEARLINE_COLOR;
@Deprecated ColorKey SELECTED_FOLDING_TREE_COLOR = SELECTED_TEARLINE_COLOR;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ public class GeneralColorsPage implements ColorSettingsPage, InspectionColorSett
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.line.number"), EditorColors.LINE_NUMBERS_COLOR, ColorDescriptor.Kind.FOREGROUND),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.tearline"), EditorColors.TEARLINE_COLOR, ColorDescriptor.Kind.FOREGROUND),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.tearline.selected"), EditorColors.SELECTED_TEARLINE_COLOR, ColorDescriptor.Kind.FOREGROUND),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.separator.above"), EditorColors.SEPARATOR_ABOVE_COLOR, ColorDescriptor.Kind.FOREGROUND),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.separator.below"), EditorColors.SEPARATOR_BELOW_COLOR, ColorDescriptor.Kind.FOREGROUND),
new ColorDescriptor(OptionsBundle.message("options.java.color.descriptor.method.separator.color"), CodeInsightColors.METHOD_SEPARATORS_COLOR, ColorDescriptor.Kind.FOREGROUND),
new ColorDescriptor(OptionsBundle.message("options.general.color.soft.wrap.sign"), EditorColors.SOFT_WRAP_SIGN_COLOR, ColorDescriptor.Kind.FOREGROUND),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,12 @@ public FileEditor[] openFile(@NotNull VirtualFile file, boolean focusEditor, boo
* If a separator line is not needed, set the client property to {@code true}:
* <pre> component.putClientProperty(SEPARATOR_DISABLED, true); </pre>
* Otherwise, a separator line will be painted by a
* {@link com.intellij.openapi.editor.colors.EditorColors#TEARLINE_COLOR TEARLINE_COLOR}.
* {@link com.intellij.openapi.editor.colors.EditorColors#SEPARATOR_ABOVE_COLOR SEPARATOR_ABOVE_COLOR} or
* {@link com.intellij.openapi.editor.colors.EditorColors#TEARLINE_COLOR TEARLINE_COLOR} if it is not set.
* <p>
* This method allows to add several components above the editor.
* To change an order of components the specified component may implement the
* {@link com.intellij.openapi.util.Weighted Weighted} interface.
*/
public abstract void addTopComponent(@NotNull final FileEditor editor, @NotNull final JComponent component);
public abstract void removeTopComponent(@NotNull final FileEditor editor, @NotNull final JComponent component);
Expand All @@ -159,8 +163,12 @@ public FileEditor[] openFile(@NotNull VirtualFile file, boolean focusEditor, boo
* If a separator line is not needed, set the client property to {@code true}:
* <pre> component.putClientProperty(SEPARATOR_DISABLED, true); </pre>
* Otherwise, a separator line will be painted by a
* {@link com.intellij.openapi.editor.colors.EditorColors#TEARLINE_COLOR TEARLINE_COLOR}.
* {@link com.intellij.openapi.editor.colors.EditorColors#SEPARATOR_BELOW_COLOR SEPARATOR_BELOW_COLOR} or
* {@link com.intellij.openapi.editor.colors.EditorColors#TEARLINE_COLOR TEARLINE_COLOR} if it is not set.
* <p>
* This method allows to add several components below the editor.
* To change an order of components the specified component may implement the
* {@link com.intellij.openapi.util.Weighted Weighted} interface.
*/
public abstract void addBottomComponent(@NotNull final FileEditor editor, @NotNull final JComponent component);
public abstract void removeBottomComponent(@NotNull final FileEditor editor, @NotNull final JComponent component);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.fileEditor.*;
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
import com.intellij.openapi.fileEditor.ex.FileEditorProviderManager;
Expand Down Expand Up @@ -520,7 +521,9 @@ private static SideBorder createTopBottomSideBorder(boolean top) {
return new SideBorder(null, top ? SideBorder.BOTTOM : SideBorder.TOP) {
@Override
public Color getLineColor() {
Color result = EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.TEARLINE_COLOR);
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
Color result = scheme.getColor(top ? EditorColors.SEPARATOR_ABOVE_COLOR : EditorColors.SEPARATOR_BELOW_COLOR);
if (result == null) result = scheme.getColor(EditorColors.TEARLINE_COLOR);
return result == null ? JBColor.BLACK : result;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ options.general.color.descriptor.vcs.annotations=VCS Annotations//Foreground
options.general.color.descriptor.vcs.annotations.color.n=VCS Annotations//Background color #{0}
options.general.color.descriptor.tearline=Editor//Tear line
options.general.color.descriptor.tearline.selected=Editor//Tear line selection
options.general.color.descriptor.separator.above=Editor//Separator line above
options.general.color.descriptor.separator.below=Editor//Separator line below
options.general.color.descriptor.added.lines=Editor Gutter//Added lines
options.general.color.descriptor.modified.lines=Editor Gutter//Modified lines
options.general.color.descriptor.deleted.lines=Editor Gutter//Deleted lines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<option name="SOFT_WRAP_SIGN_COLOR" value="c0c0c0"/>
<option name="TEARLINE_COLOR" value="D0D0D0"/>
<option name="SELECTED_TEARLINE_COLOR" value="9C9C9C"/>
<option name="SEPARATOR_ABOVE_COLOR" value=""/>
<option name="SEPARATOR_BELOW_COLOR" value="e4e4e4"/>
<option name="READONLY_FRAGMENT_BACKGROUND" value="cfe7ff"/>

<option name="ADDED_LINES_COLOR" value="c9dec1" deuteranopia="99ca90" protanopia="99ca90"/>
Expand Down Expand Up @@ -1097,6 +1099,8 @@
<option name="RIGHT_MARGIN_COLOR" value="4d4d4d" />
<option name="SELECTED_INDENT_GUIDE" value="505050" />
<option name="SELECTED_TEARLINE_COLOR" value="787878" />
<option name="SEPARATOR_ABOVE_COLOR" value=""/>
<option name="SEPARATOR_BELOW_COLOR" value="393a3c"/>
<option name="SELECTION_BACKGROUND" value="214283" />
<option name="SELECTION_FOREGROUND" value="" />
<option name="TEARLINE_COLOR" value="555555" />
Expand Down

0 comments on commit dda1191

Please sign in to comment.