diff options
author | Michael Vetter <jubalh@iodoru.org> | 2019-08-23 14:24:44 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2019-08-23 14:24:44 +0200 |
commit | c2a565c2ec3a9f22ce6c4c97ef5ba219981462a5 (patch) | |
tree | b37eed9a1dbd96b8c870ca3134a5f359fb39a450 /src/config | |
parent | 42fb1935c4d34889d3939903eefb9b5a602727fd (diff) | |
download | profani-tty-c2a565c2ec3a9f22ce6c4c97ef5ba219981462a5.tar.gz |
Notify trying to load 256 colour theme in incapable terminal
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/color.c | 7 | ||||
-rw-r--r-- | src/config/theme.c | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/config/color.c b/src/config/color.c index bc6595f2..d80b2b36 100644 --- a/src/config/color.c +++ b/src/config/color.c @@ -398,6 +398,13 @@ int color_pair_cache_get(const char *pair_name) return -1; } + if (COLORS < 256) { + if (fg > 7 || bg > 7) { + log_error("Color: trying to load 256 colour theme without capable terminal"); + return -1; + } + } + /* try to find pair in cache */ for (i = 0; i < cache.size; i++) { if (fg == cache.pairs[i].fg && bg == cache.pairs[i].bg) { diff --git a/src/config/theme.c b/src/config/theme.c index e0c9d541..ab0041d9 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -52,6 +52,7 @@ #include "config/theme.h" #include "config/preferences.h" #include "config/color.h" +#include "ui/ui.h" static GString *theme_loc; static GKeyFile *theme; @@ -809,7 +810,7 @@ theme_attrs(theme_item_t attrs) // lookup colour pair result = color_pair_cache_get(lookup_str->str); if (result < 0) { - log_error("Invalid color <%s>", lookup_str->str); + cons_show("Unable to load colour theme"); result = 0; } g_string_free(lookup_str, TRUE); |