Closed joshday closed 4 months ago
For anyone who finds yourself at this issue, read the response by @ronisbr in the linked issue at OnlineStats.
Hi @joshday !
I replied to that original thread! In PrettyTables.jl, you just need to wrap the string inside an AnsiTextCell
:
julia> pretty_table([AnsiTextCell(sprint(print, A(); context = :color => true))])
However, I think the source of the original problem is really how print
is used.
How should one implement a styled show method that works with PrettyTables? The IO passed to the show method indicates colors are okay, but PrettyTables prints the ANSI codes. I'm sure this is due to the (very cool) highlighting features of PrettyTables, but how would one handle both colors in the REPL and no ANSI codes in the
pretty_table
?Maybe PrettyTables should at least be passing
IOContext(io, :color => false)
to the show methods of the elements?