Skip to content

Commit

Permalink
Colors: Workaround for colors #000000 to neomutt#7
Browse files Browse the repository at this point in the history
The colours #000000 to neomutt#7 correspond to the numbers 0 to 7.  Even
when calling the *_extended_* functions of ncurses those colours
correspond to the eight default terminal colours and not to some dark
blacks.  Interestingly, colour numbers 8 to 15 (the default bright
colours of the terminal), do not show this behaviour.

As a workaround we round these eight RGB colours up to neomutt#8 (the
darkest black we can achieve) and hope nobody notices.
  • Loading branch information
rayfordshire authored and flatcap committed Mar 22, 2023
1 parent 3db5077 commit 35931db
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions color/command.c
Expand Up @@ -287,6 +287,11 @@ static enum CommandResult parse_color_name(const char *s, uint32_t *col, int *at
/* If we are running in direct color mode, we must convert the xterm
* color numbers 0-255 to an RGB value. */
*col = color_xterm256_to_24bit(*col);
/* FIXME: The color values 0 to 7 (both inclusive) are still occupied by
* the default terminal colours. As a workaround we round them up to
* #000008 which is the blackest black we can produce. */
if (*col < 8)
*col = 8;
}
#endif
color_debug(LL_DEBUG5, "colorNNN %d\n", *col);
Expand Down Expand Up @@ -314,6 +319,12 @@ static enum CommandResult parse_color_name(const char *s, uint32_t *col, int *at
mutt_buffer_printf(err, _("%s: color not supported by term"), s);
return MUTT_CMD_ERROR;
}
/* FIXME: The color values 0 to 7 (both inclusive) are still occupied by
* the default terminal colours. As a workaround we round them up to
* #000008 which is the blackest black we can produce. */
if (*col < 8)
*col = 8;

color_debug(LL_DEBUG5, "#RRGGBB: %d\n", *col);
return MUTT_CMD_SUCCESS;
}
Expand Down

0 comments on commit 35931db

Please sign in to comment.