From: Karel Zak Date: Mon, 7 Jul 2025 13:10:52 +0000 (+0200) Subject: column: add basic colors support X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=717c5693832b89ee7526d6377c72b844a6b7c3e5;p=thirdparty%2Futil-linux.git column: add basic colors support Signed-off-by: Karel Zak --- diff --git a/text-utils/column.1.adoc b/text-utils/column.1.adoc index 73a8676d2..355e776fa 100644 --- a/text-utils/column.1.adoc +++ b/text-utils/column.1.adoc @@ -136,6 +136,13 @@ Allow using a multi-line cell for long text if necessary. See *--table-wrap* for Don't print the column. See *--table-hide* for more details. **json=**_type_;; Define the column type for JSON output. Supported types are *string*, *number* and *boolean*. +**color=**_name_;; +Define the column color for output on the terminal. The _name_ is a color name +(black, blink, blue, bold, brown, cyan, darkgray, gray, green, halfbright, +lightblue, lightcyan, lightgray, lightgreen, lightmagenta, lightred, magenta, +red, reset, reverse, and yellow) or ANSI color sequence number(s) separated by +a semicolon, but without the 'ESC[' prefix and 'm' suffix. For example, "37;41" +defines sequences for a red background and white foreground. *-N, --table-columns* _names_:: Specify column names with a comma-separated list. The names are used for the table header diff --git a/text-utils/column.c b/text-utils/column.c index c3321ae16..a6757a4f3 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -346,6 +346,7 @@ static void init_table(struct column_control *ctl) scols_table_enable_noencoding(ctl->tab, 1); scols_table_enable_maxout(ctl->tab, ctl->maxout ? 1 : 0); + scols_table_enable_colors(ctl->tab, 1); if (ctl->tab_columns) { char **opts;