From d89e78f732a1a8b82488f078dbc17b1b5d2eba31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s?= Date: Fri, 19 Mar 2021 15:34:45 -0300 Subject: Try to handle ncurses version prior to 6.1 --- src/color.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/color.c') diff --git a/src/color.c b/src/color.c index 8c3c371..ff370c5 100644 --- a/src/color.c +++ b/src/color.c @@ -577,7 +577,11 @@ int redefine_color(char * color, int r, int g, int b) { sc_error("Color not found"); return -1; } +#if defined(NCURSES_VERSION_MAJOR) && (( NCURSES_VERSION_MAJOR > 5 && defined(NCURSES_VERSION_MINOR) && NCURSES_VERSION_MINOR > 0) || NCURSES_VERSION_MAJOR > 6) if (init_extended_color(atoi(s), RGB(r, g, b)) == 0) { +#else + if (init_color(atoi(s), RGB(r, g, b)) == 0) { +#endif sig_winchg(); if (! loading) sc_info("Color %s redefined to %d %d %d.", color, r, g, b); return 0; @@ -639,7 +643,11 @@ int define_color(char * color, int r, int g, int b) { cc->r = r; cc->g = g; cc->b = b; +#if defined(NCURSES_VERSION_MAJOR) && (( NCURSES_VERSION_MAJOR > 5 && defined(NCURSES_VERSION_MINOR) && NCURSES_VERSION_MINOR > 0) || NCURSES_VERSION_MAJOR > 6) init_extended_color(7 + cc->number, RGB(r, g, b)); +#else + init_color(7 + cc->number, RGB(r, g, b)); +#endif if (! loading) sc_info("Defined custom color #%d with name '%s' and RGB values %d %d %d", cc->number, cc->name, cc->r, cc->g, cc->b); return 0; -- cgit v1.2.3