]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
column: add basic colors support
authorKarel Zak <kzak@redhat.com>
Mon, 7 Jul 2025 13:10:52 +0000 (15:10 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 7 Jul 2025 13:10:52 +0000 (15:10 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/column.1.adoc
text-utils/column.c

index 73a8676d21cc00ccb7f0e5fb7a04366884aa900d..355e776facafa23130be61367ce9f6838ae5672a 100644 (file)
@@ -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
index c3321ae166636e24196e39f67901cd0905f86247..a6757a4f3d80b9a8227489e9d01cc967c246ca0e 100644 (file)
@@ -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;