From 8641fedd42bce2a5118371eab68fe6259573406d Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Sun, 7 Oct 2018 14:51:49 +0200 Subject: [PATCH] IDEA-200074 Add color scheme key for line number on caret line --- .../com/intellij/openapi/editor/colors/EditorColors.java | 1 + .../openapi/options/colors/pages/GeneralColorsPage.java | 1 + .../openapi/editor/impl/EditorGutterComponentImpl.java | 6 +++--- .../src/messages/OptionsBundle.properties | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/EditorColors.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/EditorColors.java index 47411a0fe2b81..2a2ea863a78a3 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/EditorColors.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/EditorColors.java @@ -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"); diff --git a/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java b/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java index 4e0ac20fd1faf..732544e6d6472 100644 --- a/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java +++ b/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java @@ -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), diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java index 1ed64d8272606..09a19188d6ff3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java @@ -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); @@ -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); diff --git a/platform/platform-resources-en/src/messages/OptionsBundle.properties b/platform/platform-resources-en/src/messages/OptionsBundle.properties index 403e07b944552..f6a6c1ae3cf13 100644 --- a/platform/platform-resources-en/src/messages/OptionsBundle.properties +++ b/platform/platform-resources-en/src/messages/OptionsBundle.properties @@ -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//