From 9438b6c87f1552be4389afe4abf7bdc3b30ad203 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Mon, 12 Nov 2007 22:12:27 +0100 Subject: [PATCH] Assume default colors are white on black for xterm, and use it if available. Signed-off-by: Pierre Habouzit --- lib-ui/madtty.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib-ui/madtty.c b/lib-ui/madtty.c index 85bd257..4cc53fb 100644 --- a/lib-ui/madtty.c +++ b/lib-ui/madtty.c @@ -957,7 +957,6 @@ void madtty_init_colors(void) { if (COLOR_PAIRS > 64) { use_default_colors(); - assume_default_colors(-1, -1); has_default = 1; for (int bg = -1; bg < 8; bg++) { @@ -966,9 +965,16 @@ void madtty_init_colors(void) } } } else { + int use_default = use_default_colors() == OK; for (int bg = 0; bg < 8; bg++) { for (int fg = 0; fg < 8; fg++) { - init_pair((7 - fg) * 8 + bg, fg, bg); + if (use_default) { + init_pair((7 - fg) * 8 + bg, + fg == COLOR_WHITE ? -1 : fg, + bg == COLOR_BLACK ? -1 : bg); + } else { + init_pair((7 - fg) * 8 + bg, fg, bg); + } } } } -- 2.20.1