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:
@@ -748,6 +748,7 @@ curses: for vertical status, line up conditions in columns; usually two but
|
||||
used to align entries in their columns--that's a feature...]
|
||||
curses: indent items in perm_invent window by one space
|
||||
curses: don't change the terminal's default colors
|
||||
curses: remove unnecessary special handling for dark gray
|
||||
macOS: Xcode project was failing to build if the path to the NetHack source
|
||||
tree contained a space; the issue was within some shell script code
|
||||
contained within the project
|
||||
|
||||
@@ -358,6 +358,11 @@ curses_init_nhcolors(void)
|
||||
|
||||
|
||||
if (COLORS >= 16) {
|
||||
# ifdef USE_DARKGRAY
|
||||
if (iflags.wc2_darkgray) {
|
||||
init_pair(1, COLOR_BLACK + 8, -1);
|
||||
}
|
||||
# endif
|
||||
init_pair(9, COLOR_WHITE, -1);
|
||||
init_pair(10, COLOR_RED + 8, -1);
|
||||
init_pair(11, COLOR_GREEN + 8, -1);
|
||||
@@ -367,18 +372,6 @@ curses_init_nhcolors(void)
|
||||
init_pair(15, COLOR_CYAN + 8, -1);
|
||||
init_pair(16, COLOR_WHITE + 8, -1);
|
||||
}
|
||||
|
||||
if (can_change_color()) {
|
||||
# ifdef USE_DARKGRAY
|
||||
if (COLORS > 16) {
|
||||
color_content(CURSES_DARK_GRAY, &orig_darkgray.r,
|
||||
&orig_darkgray.g, &orig_darkgray.b);
|
||||
init_color(CURSES_DARK_GRAY, 300, 300, 300);
|
||||
/* just override black colorpair entry here */
|
||||
init_pair(1, CURSES_DARK_GRAY, -1);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -857,14 +850,4 @@ curses_display_splash_window(void)
|
||||
void
|
||||
curses_cleanup(void)
|
||||
{
|
||||
#ifdef TEXTCOLOR
|
||||
if (has_colors() && can_change_color()) {
|
||||
# ifdef USE_DARKGRAY
|
||||
if (COLORS > 16) {
|
||||
init_color(CURSES_DARK_GRAY, orig_darkgray.r,
|
||||
orig_darkgray.g, orig_darkgray.b);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1553,7 +1553,7 @@ curses_color_attr(int nh_color, int bg_color)
|
||||
if (!nh_color) {
|
||||
#ifdef USE_DARKGRAY
|
||||
if (iflags.wc2_darkgray) {
|
||||
if (!can_change_color() || COLORS <= 16)
|
||||
if (COLORS <= 16)
|
||||
cattr |= A_BOLD;
|
||||
} else
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user