[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/4] rcfile: allow specifying an intense background color (with p
From: |
Benno Schulenberg |
Subject: |
[PATCH 2/4] rcfile: allow specifying an intense background color (with prefix "lit") |
Date: |
Thu, 11 Jun 2020 20:02:50 +0200 |
If the terminal is capable of more than eight colors, specifying
indexes 8 to 15 works fine for getting a light background color.
---
src/rcfile.c | 6 ++++--
syntax/nanorc.nanorc | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/rcfile.c b/src/rcfile.c
index 5df2c542..29a4e962 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -1031,12 +1031,14 @@ bool parse_combination(char *combostr, short *fg, short
*bg, int *attributes)
if (comma != NULL) {
*bg = color_to_short(comma + 1, &vivid, &thick);
- if (vivid) {
+ if (vivid && thick) {
jot_error(N_("A background color cannot be bright"));
return FALSE;
}
if (*bg == BAD_COLOR)
return FALSE;
+ if (vivid && COLORS > 8)
+ *bg += 8;
*comma = '\0';
} else
*bg = USE_THE_DEFAULT;
@@ -1048,7 +1050,7 @@ bool parse_combination(char *combostr, short *fg, short
*bg, int *attributes)
if (vivid && !thick && COLORS > 8)
*fg += 8;
else if (vivid)
- *attributes = A_BOLD;
+ *attributes |= A_BOLD;
} else
*fg = USE_THE_DEFAULT;
diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc
index 0b489b4d..3c6d217b 100644
--- a/syntax/nanorc.nanorc
+++ b/syntax/nanorc.nanorc
@@ -21,7 +21,7 @@ color green
"^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|f
color brightmagenta "([[:space:]]|(start|end)=)".+"([[:space:]]|$)"
# Colors
-color yellow
"^[[:space:]]*i?color[[:space:]]*(bright|lit)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
+color yellow
"^[[:space:]]*i?color[[:space:]]*(bright|lit)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(lit)?(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
color magenta "^[[:space:]]*i?color\>" "\<(start|end)="
# Comments
--
2.25.4
Re: [PATCH 1/4] rcfile: accept prefix "lit" to make a color brighter without bolding it, Saagar Jha, 2020/06/11