tennis is a small CLI for printing stylish CSV tables in your terminal. Rows will be truncated to fit and it'll automatically pick nice colors to match your terminal. Written in Zig. Demo:
$ brew install gurgeous/tap/tennis$ mise trust && mise install
$ zig build- auto-layout to fit your terminal window
- auto-themes to pick light or dark based on your terminal background
- titles, row numbers...
Usage: tennis [options] <FILE>
Options:
--color <COLOR> Turn color off and on (on|off|auto)
--theme <THEME> Select color theme (auto|dark|light)
-n, --row-numbers Turn on row numbers
-t, --title <STRING> Add a title to the table
-w, --width <INT> Set max table width in columns
Note that color defaults to on. Tennis likes to be colorful.
tennis uses a termbg.zig module to detect the terminal background color so it can choose the correct theme (dark or light). Detection is complicated, and I'm calling it out here because I don't think anyone has implemented this in Zig yet.
There are many features I can add if there is demand, including zebra striping, numeric formatting, color scales, more control over column layout, etc. Other areas to explore:
- windows support
- use
zgfor string measuring and truncation of graphemes (vs codepoints)
We love CSV tools and use them all the time! Here are a few that we rely on:
- bat - syntax highlights csv files, and many others
- csvlens & tidy viewer - great viewers for CSV files, beautiful and fun
- qsv - filter, sort, combine, join... (a fork of xsv)
- Terminal::Table - wonderful rubygem for pretty printing tables, great for non-hash data like confusion matrices
- visidata - the best for poking around large files, it does everything
- table_tennis - my own project, the basis for this one
- Initial release.

