From 4caf57b4319f85e9e9203cb6fefec6845d961220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s?= Date: Mon, 15 Mar 2021 09:27:08 -0300 Subject: Avoid defining a stock NCURSES color. Suggest :redefine for that purpose. --- src/color.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/color.c') diff --git a/src/color.c b/src/color.c index 259027b..1ab5308 100644 --- a/src/color.c +++ b/src/color.c @@ -606,6 +606,11 @@ int define_color(char * color, int r, int g, int b) { } else if (! has_colors () || ! can_change_color() || COLORS < 9) { sc_error("Could not define color %s. Not supported by terminal.", color); return -1; + + } else if (get(d_colors_param, color) != NULL) { + sc_error("Could not define custom color %s. That is an ncurses color. Use :redefine for that purpose.", color); + return -1; + } else if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) { sc_error("Could not define color %s. One of the RGB values is invalid.", color); return -1; -- cgit v1.2.3