Color (final Editor editor) { Color overriddenColor = editor.getCaretModel().getPrimaryCaret().getVisualAttributes().getColor(); if (overriddenColor != null) return overriddenColor; final Color caretColor = editor.getColorsScheme().getColor(EditorColors.CARET_COLOR); return caretColor == null ? new JBColor(Gray._0, Gray._255) : caretColor; }