return scols_cell_get_data(&cl->header);
}
+/**
+ * scols_column_set_headercolor:
+ * @cl: a pointer to a struct libscols_column instance
+ * @color: color name or ESC sequence
+ *
+ * The set header color.
+ *
+ * Returns: 0, a negative value in case of an error.
+ *
+ * Since: 2.42
+ */
+int scols_column_set_headercolor(struct libscols_column *cl, const char *color)
+{
+ struct libscols_cell *hdr = scols_column_get_header(cl);
+
+ if (!hdr)
+ return -EINVAL;
+
+ return scols_cell_set_color(hdr, color);
+}
+
+/**
+ * scols_column_get_headercolor:
+ * @cl: a pointer to a struct libscols_column instance
+ *
+ * Returns: The current color setting of the column header or NULL.
+ *
+ * Since: 2.42
+ */
+const char *scols_column_get_headercolor(struct libscols_column *cl)
+{
+ struct libscols_cell *hdr = scols_column_get_header(cl);
+
+ if (hdr)
+ return scols_cell_get_color(hdr);
+ return NULL;
+}
+
/**
* scols_shellvar_name:
* @name: raw (column) name
* The default color for data cells and column header.
*
* If you want to set header specific color then use scols_column_get_header()
- * and scols_cell_set_color().
+ * and scols_cell_set_color() or scols_column_set_headercolor() since v2.42.
*
* If you want to set data cell specific color the use scols_line_get_cell() +
* scols_cell_set_color().
* @cl: a pointer to a struct libscols_column instance
* @opts: options string
*
- * Set properties from string, the string is comma separated list, like
- * "trunc,right,json=number", ...
+ * Set properties from string, the string is comma separated list. Supported
+ * properties are: trunc, tree, right, strictwidth, noextremes, hidden, wrap,
+ * wrapnl, wrapzero,json={string,number,float,array-string,array-number,boolean},
+ * width=, color=, headercolor= and name=.
*
* Returns: 0 on success, <0 on error
*
free(x);
}
+ } else if (value && strncmp(name, "headercolor", namesz) == 0) {
+
+ char *x = strndup(value, valuesz);
+ if (x) {
+ scols_column_set_headercolor(cl, x);
+ free(x);
+ }
+
} else if (value && strncmp(name, "name", namesz) == 0) {
char *x = strndup(value, valuesz);
extern struct libscols_column *scols_copy_column(const struct libscols_column *cl);
extern int scols_column_set_whint(struct libscols_column *cl, double whint);
extern double scols_column_get_whint(const struct libscols_column *cl);
+
extern struct libscols_cell *scols_column_get_header(struct libscols_column *cl);
+extern int scols_column_set_headercolor(struct libscols_column *cl, const char *color);
+extern const char *scols_column_get_headercolor(struct libscols_column *cl);
+
extern int scols_column_set_color(struct libscols_column *cl, const char *color);
extern const char *scols_column_get_color(const struct libscols_column *cl);
extern struct libscols_table *scols_column_get_table(const struct libscols_column *cl);