+#include "tweak.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
-
#include <curses.h>
-#include "tweak.h"
-
int display_rows, display_cols;
void display_beep(void)
move(0,0);
refresh();
get_screen_size();
- if (has_colors())
+ if (has_colors()) {
start_color();
+ use_default_colors();
+ }
}
void display_cleanup(void)
#define MAXCOLOURS 32
int attrs[MAXCOLOURS];
-void display_define_colour(int colour, int fg, int bg)
+void display_define_colour(int colour, int fg, int bg, int reverse)
{
static int colours[8] = {
COLOR_BLACK,
COLOR_WHITE,
};
- assert(colour >= 0 && colour < MAXCOLOURS && colour < COLOR_PAIRS-2);
-
- assert(!(bg & ~7)); /* bold backgrounds are nonportable */
- init_pair(colour+1, colours[fg & 7], colours[bg]);
- attrs[colour] = (fg & 8 ? A_BOLD : 0) | COLOR_PAIR(colour+1);
+ if (fg < 0 && bg < 0) {
+ attrs[colour] = 0;
+ } else {
+ assert(colour >= 0 && colour < MAXCOLOURS);
+ assert(!(bg & ~7)); /* bold backgrounds are nonportable */
+ if (colour < COLOR_PAIRS-2) {
+ init_pair(colour+1, colours[fg & 7], colours[bg]);
+ attrs[colour] = (fg & 8 ? A_BOLD : 0) | COLOR_PAIR(colour+1);
+ } else {
+ /* can't allocate a colour pair, so we just use b&w attrs */
+ attrs[colour] = (fg & 8 ? A_BOLD : 0) | (reverse ? A_REVERSE : 0);
+ }
+ }
}
void display_set_colour(int colour)