summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/column.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsmartcols/src/column.c')
-rw-r--r--libsmartcols/src/column.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libsmartcols/src/column.c b/libsmartcols/src/column.c
index 5fad5319f..29eb63666 100644
--- a/libsmartcols/src/column.c
+++ b/libsmartcols/src/column.c
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include <ctype.h>
#include "smartcolsP.h"
@@ -118,6 +119,12 @@ int scols_column_set_color(struct libscols_column *cl, const char *color)
if (!cl)
return -EINVAL;
if (color) {
+ if (isalnum(*color)) {
+ color = colorscheme_from_string(color);
+
+ if (!color)
+ return -EINVAL;
+ }
p = strdup(color);
if (!p)
return -ENOMEM;