Create curses colour pairs for 256 colours

Keep only 8 background colours but if curses supports 256 colours and
256*8 colours pairs, create colours pairs for 256 foregrounds rather
than just 16.
This commit is contained in:
Doktor L
2026-06-19 16:36:27 +02:00
committed by Patric Mueller
parent 7036f902d2
commit 19c87585fa
4 changed files with 22 additions and 7 deletions
+7 -1
View File
@@ -91,6 +91,12 @@ curses_read_char(void)
return ch;
}
boolean
curses_has_256color(void)
{
return (COLORS >= 256) && (COLOR_PAIRS >= 256 * CURSES_NUM_BACKGROUND_COLORS);
}
/* Turn on or off the specified color and / or attribute */
void
@@ -147,7 +153,7 @@ curses_toggle_color_attr(WINDOW *win, int color, int attr, int onoff)
if (use_bold) {
wattron(win, A_BOLD);
}
wattron(win, COLOR_PAIR(curses_color));
wcolor_set(win, curses_color, &curses_color);
}
if (attr != NONE) {