aboutsummaryrefslogtreecommitdiffstats
path: root/src/custom.c
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2017-12-07 16:36:01 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2017-12-10 14:33:31 +0100
commite733d09ea02897e7013a0745223b777ae5981fd5 (patch)
treeaef4173e5f34d69feda7b596b6b8b145133ca508 /src/custom.c
parent95c5d576fafa2f705e6562f57bab9a9d583c8776 (diff)
downloadcalcurse-e733d09ea02897e7013a0745223b777ae5981fd5.tar.gz
calcurse-e733d09ea02897e7013a0745223b777ae5981fd5.zip
Default colour as foreground colour
In the default colour setup (white on black), white could only with great difficulty be used as customized foreground colour, because the colour pair COLR_CUSTOM then was identical to COLR_DEFAULT (default on default). This made it impossible to distinguish the selected element in lists. The patch turns on the video attribute bold when default is chosen as foreground colour. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/custom.c')
-rw-r--r--src/custom.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/custom.c b/src/custom.c
index f528d32..a7ded71 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -58,7 +58,13 @@ static struct attribute attr;
*/
void custom_init_attr(void)
{
- attr.color[ATTR_HIGHEST] = COLOR_PAIR(COLR_CUSTOM);
+ short col_fg;
+ pair_content(COLR_CUSTOM, &col_fg, NULL);
+
+ attr.color[ATTR_HIGHEST] =
+ (col_fg == -1 || col_fg == 255) ?
+ COLOR_PAIR(COLR_CUSTOM) | A_BOLD :
+ COLOR_PAIR(COLR_CUSTOM);
attr.color[ATTR_HIGH] = COLOR_PAIR(COLR_HIGH);
attr.color[ATTR_MIDDLE] = COLOR_PAIR(COLR_RED) | A_BOLD;
attr.color[ATTR_LOW] = COLOR_PAIR(COLR_CYAN);
@@ -371,6 +377,7 @@ display_color_config(struct window *cwin, int *mark_fore, int *mark_back,
if (colr_back == 255)
colr_back = -1;
init_pair(COLR_CUSTOM, colr_fore, colr_back);
+ custom_init_attr();
} else {
/* Retrieve the actual color theme. */
pair_content(COLR_CUSTOM, &colr_fore, &colr_back);
@@ -379,7 +386,8 @@ display_color_config(struct window *cwin, int *mark_fore, int *mark_back,
|| (colr_fore == DEFAULTCOLOR_EXT)) {
*mark_fore = NBUSERCOLORS;
} else {
- for (i = 0; i < NBUSERCOLORS + 1; i++)
+ for (i = 0; i < NBUSERCOLORS; i++)
+ /* WARNING. Colour pair number used as colour number. */
if (colr_fore == colr[i])
*mark_fore = i;
}
@@ -388,7 +396,8 @@ display_color_config(struct window *cwin, int *mark_fore, int *mark_back,
|| (colr_back == DEFAULTCOLOR_EXT)) {
*mark_back = SIZE - 1;
} else {
- for (i = 0; i < NBUSERCOLORS + 1; i++)
+ for (i = 0; i < NBUSERCOLORS; i++)
+ /* WARNING. Colour pair number used as colour number. */
if (colr_back ==
colr[NBUSERCOLORS + 1 + i])
*mark_back =