curses: remove unnecessary special handling for dark gray

On terminals with at least 16 colors there should be no need for special
handling dark gray.

The curses code uses COLORS < 16, COLORS <= 16, COLORS > 16, or COLORS >= 16
at several places although I'm not sure if they are correct or which could
possibly be off-by-one errors.

But realistically in this case, we only need to distinguish between 8 color
terminals and terminals supporting more than 8 colors as this will mean the
terminal supports at least 256 colors.
This commit is contained in:
Patric Mueller
2021-06-05 14:38:41 +02:00
parent 6e7f1bc1f0
commit 5c15ca1002
4 changed files with 9 additions and 25 deletions
+2 -2
View File
@@ -100,7 +100,7 @@ curses_toggle_color_attr(WINDOW *win, int color, int attr, int onoff)
if (color == 0) { /* make black fg visible */
# ifdef USE_DARKGRAY
if (iflags.wc2_darkgray) {
if (can_change_color() && (COLORS > 16)) {
if (COLORS > 16) {
/* colorpair for black is already darkgray */
} else { /* Use bold for a bright black */
wattron(win, A_BOLD);
@@ -135,7 +135,7 @@ curses_toggle_color_attr(WINDOW *win, int color, int attr, int onoff)
wattroff(win, A_BOLD);
}
# ifdef USE_DARKGRAY
if ((color == 0) && (!can_change_color() || (COLORS <= 16))) {
if ((color == 0) && (COLORS <= 16)) {
wattroff(win, A_BOLD);
}
# else