support for ansi escapes in text
This PR adds support for ansi escapes, allowing you to have colorized text in tables.
Thanks for the PR @mikecarlton-illumio. The request to be able to colorize the cell contents has come up before. I've been wanting to add this feature and I've been thinking of doing so through a formatter block. Something like:
table.formatter = ->(cell) {
colorize(cell.value)
}
This way, width computation is done before formatting (colorizing) the cell value.
That's interesting, but if I understand your comment correctly, I would define a function to apply color to a cell as a whole?
I think our use case is slightly different -- I'm including status info by coloring the text (green or red). Thus the color isn't a function of the cell or of the value itself, but is only known when the text is added to the cell.
Here's a sample:
