Skip to content

Commit

Permalink
IDEA-200074 Add color scheme key for line number on caret line
Browse files Browse the repository at this point in the history
  • Loading branch information
bulenkov committed Oct 7, 2018
1 parent f4378ac commit 8641fed
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public interface EditorColors {
ColorKey CARET_COLOR = ColorKey.createColorKey("CARET_COLOR");
ColorKey RIGHT_MARGIN_COLOR = ColorKey.createColorKey("RIGHT_MARGIN_COLOR");
ColorKey LINE_NUMBERS_COLOR = ColorKey.createColorKey("LINE_NUMBERS_COLOR");
ColorKey LINE_NUMBER_ON_CARET_ROW_COLOR = ColorKey.createColorKey("LINE_NUMBER_ON_CARET_ROW_COLOR");
ColorKey ANNOTATIONS_COLOR = ColorKey.createColorKey("ANNOTATIONS_COLOR");
ColorKey READONLY_BACKGROUND_COLOR = ColorKey.createColorKey("READONLY_BACKGROUND");
ColorKey READONLY_FRAGMENT_BACKGROUND_COLOR = ColorKey.createColorKey("READONLY_FRAGMENT_BACKGROUND");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public class GeneralColorsPage implements ColorSettingsPage, InspectionColorSett
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.indent.guide"), EditorColors.INDENT_GUIDE_COLOR, ColorDescriptor.Kind.BACKGROUND),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.indent.guide.selected"), EditorColors.SELECTED_INDENT_GUIDE_COLOR, ColorDescriptor.Kind.BACKGROUND),
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.line.number.on.caret.row"), EditorColors.LINE_NUMBER_ON_CARET_ROW_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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ private void doPaintLineNumbers(Graphics2D g, int startVisualLine, int endVisual
}

Color color = myEditor.getColorsScheme().getColor(EditorColors.LINE_NUMBERS_COLOR);
Color colorUnderCaretRow = myEditor.getColorsScheme().getColor(EditorColors.LINE_NUMBER_ON_CARET_ROW_COLOR);
g.setColor(color != null ? color : JBColor.blue);
Font font = getFontForLineNumbers();
g.setFont(font);
Expand All @@ -574,9 +575,8 @@ private void doPaintLineNumbers(Graphics2D g, int startVisualLine, int endVisual
g.setColor(color);
}

//todo[kb] move to editor scheme when have colors for Default and Darcula
if (Registry.is("editor.highlight.current.line.number") && myEditor.getCaretModel().getLogicalPosition().line == logLine) {
g.setColor(Registry.getColor("editor.highlight.current.line.color", color));
if (colorUnderCaretRow != null && myEditor.getCaretModel().getLogicalPosition().line == logLine) {
g.setColor(colorUnderCaretRow);
}

String s = String.valueOf(logLine + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ options.general.color.descriptor.whitespaces=Text//Whitespaces
options.general.color.descriptor.indent.guide=Editor//Guides//Indent guide
options.general.color.descriptor.indent.guide.selected=Editor//Guides//Indent guide selected
options.general.color.descriptor.line.number=Code//Line number
options.general.color.descriptor.line.number.on.caret.row=Code//Line number on caret row
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.vcs.diff.type.tag.prefix=Changed lines//
Expand Down

0 comments on commit 8641fed

Please sign in to comment.