[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] color: give highlighted text its own color, to not look like mar
From: |
Benno Schulenberg |
Subject: |
[PATCH] color: give highlighted text its own color, to not look like marked text |
Date: |
Tue, 9 Feb 2021 15:36:43 +0100 |
Of course this will require a subsequent patch to make the color combination
configurable, but it is not need to demonstrate the idea.
---
src/color.c | 5 ++++-
src/definitions.h | 1 +
src/nano.c | 1 +
src/winio.c | 4 ++--
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/color.c b/src/color.c
index 1ce89ddc..c41d3d10 100644
--- a/src/color.c
+++ b/src/color.c
@@ -58,7 +58,10 @@ void set_interface_colorpairs(void)
interface_color_pair[index] = A_NORMAL;
else if (index == GUIDE_STRIPE)
interface_color_pair[index] = A_REVERSE;
- else if (index == PROMPT_BAR)
+ else if (index == HIGHLIGHTED) {
+ init_pair(index + 1, COLOR_BLACK, COLOR_YELLOW);
+ interface_color_pair[index] = COLOR_PAIR(index
+ 1);
+ } else if (index == PROMPT_BAR)
interface_color_pair[index] =
interface_color_pair[TITLE_BAR];
else if (index == ERROR_MESSAGE) {
init_pair(index + 1, COLOR_WHITE, COLOR_RED);
diff --git a/src/definitions.h b/src/definitions.h
index f4d7774b..7345620a 100644
--- a/src/definitions.h
+++ b/src/definitions.h
@@ -282,6 +282,7 @@ enum {
GUIDE_STRIPE,
SCROLL_BAR,
SELECTED_TEXT,
+ HIGHLIGHTED,
PROMPT_BAR,
STATUS_BAR,
ERROR_MESSAGE,
diff --git a/src/nano.c b/src/nano.c
index 26be9dc9..114d29d0 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2325,6 +2325,7 @@ int main(int argc, char **argv)
interface_color_pair[GUIDE_STRIPE] = A_REVERSE;
interface_color_pair[SCROLL_BAR] = A_NORMAL;
interface_color_pair[SELECTED_TEXT] = hilite_attribute;
+ interface_color_pair[HIGHLIGHTED] = hilite_attribute;
interface_color_pair[PROMPT_BAR] = hilite_attribute;
interface_color_pair[STATUS_BAR] = hilite_attribute;
interface_color_pair[ERROR_MESSAGE] = hilite_attribute;
diff --git a/src/winio.c b/src/winio.c
index df0d1336..5af964ac 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -3504,11 +3504,11 @@ void spotlight(size_t from_col, size_t to_col)
word = display_string(openfile->current->data, from_col,
to_col -
from_col, FALSE, overshoots);
- wattron(edit, interface_color_pair[SELECTED_TEXT]);
+ wattron(edit, interface_color_pair[HIGHLIGHTED]);
waddnstr(edit, word, actual_x(word, to_col));
if (overshoots)
mvwaddch(edit, openfile->current_y, COLS - 1 - thebar, '>');
- wattroff(edit, interface_color_pair[SELECTED_TEXT]);
+ wattroff(edit, interface_color_pair[HIGHLIGHTED]);
free(word);
}
--
2.29.2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] color: give highlighted text its own color, to not look like marked text,
Benno Schulenberg <=