Introducing Text::ANSITable

Even in the good old days of DOS, we already had color tables and extended ASCII characters to draw various border styles. So why limit ourselves with something like Text::ASCIITable? Introducing Text::ANSITable to make your text tables look pretty in terminals. See pictures for some examples:

Features:

  • Drawing borders with box-drawing and Unicode characters.
  • Border styles. You can select and even create your own border styles. Border styles support things like custom characters, etc.
  • Full color support (256 on any xterm-256color terminal emulators, and true color on Konsole/Yakuake). Graceful degradation (autoreduce colors) on terminals that do not support higher color depth.
  • Color themes. You can select and even create your own color themes. Color themes support things like random/custom/gradation colors, etc.
  • Wide character support. Your tables will still be aligned even if your text contains wide characters.
  • ANSI support. Your tables will still be aligned even if your text contains ANSI escape codes.
  • Modular and flexible formatting system for things like text wrapping, highlighting, number formatting (thousands, scientific, kilo/kibi formatting), sprintf-style formatting, etc).
  • Per-column/per-row/per-cell styling
  • Row/column filtering
  • Column reordering.

Compared to Text::ASCIITable, Text::ANSITable uses lowercase_with_underscore for method names instead of CamelCase. I know a lot of Perl programmers, me included, prefer the former.

It's an early release so there are bound to be some quirks and bugs, but the basic features are already there. Enjoy!

2 Comments

I love people who love terminals :)

nice work! it seems to be helpful for my some CLI tools.

Leave a comment

About Steven Haryanto

user-pic A programmer (mostly Perl 5 nowadays). My CPAN ID: SHARYANTO. I'm sedusedan on perlmonks. My twitter is stevenharyanto (but I don't tweet much). Follow me on github: sharyanto.