summaryrefslogtreecommitdiffstats
path: root/src/color.c
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-03-19 15:34:45 -0300
committerAndrés <andmarti@gmail.com>2021-03-19 15:34:45 -0300
commitd89e78f732a1a8b82488f078dbc17b1b5d2eba31 (patch)
tree3daa230eb4c21f269574acb9c3bc369963de5470 /src/color.c
parenta8534aa7fdaace10139e2f6771d7a0dc26ffb62b (diff)
Try to handle ncurses version prior to 6.1
Diffstat (limited to 'src/color.c')
-rw-r--r--src/color.c8
1 files changed, 8 insertions, 0 deletions
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;