summaryrefslogtreecommitdiffstats
path: root/src/color.c
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-03-15 09:27:08 -0300
committerAndrés <andmarti@gmail.com>2021-03-15 09:27:08 -0300
commit4caf57b4319f85e9e9203cb6fefec6845d961220 (patch)
treef79e8e437529570868c648454a118f833562dd11 /src/color.c
parent5c2ba9f888572fe5e6d8a89519db58e3a55d95e1 (diff)
Avoid defining a stock NCURSES color. Suggest :redefine for that purpose.
Diffstat (limited to 'src/color.c')
-rw-r--r--src/color.c5
1 files changed, 5 insertions, 0 deletions
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;