Term.jl, a package inspired by WIll McGougan’s rich package in Python to produce stylized, structured output for your terminal, in Julia.
Term can be used to create colored and styled text, using either dedicated macros or a simple markup language:
But really it’s all about
Renderables structured graphic elements like Panel, TextBox and Tree
Renderables can be composed to create layouts. You can put almost anything in a Panel and vertically/horizontally stack multiple renderables:
Also Term.jl can be used to produce beautiful log and error messages and progress bars
Thank you, it will keep getting better I’ve got a few more features planned
How well do the things like colors work with the inline results of say VSCode
Looks awesome! This will be particularly nice for displaying results of statistical procedures in nice neat tables, with statistically significant features popping out in colour. I’ll definitely be using it.
Thank you! A couple releases down the line Term will also include a Table functionality!
March 22, 2022, 9:39am
Is this mostly meant for static output or would it also handle resizing of the terminal, and maybe some light interaction?
Currently it can only handle static output (except the progress bars that get “updated” at every referesh, but are not interactive). All you see is basically just text printed out in the terminal.
It might include some interactivity in the future, bot not any time soon.
@findmyway This could be nice for prettier agent tree printing in RL.jl, with colors coding to better differentiate the leaves of the trajectory and the policy and other sub-components for example .
For anyone that wants to stay updated on Term’s development, twitter is the best place:
Great suggestion! Will do!
March 26, 2022, 10:33am
Impressive! Could it be interactive?
Out of interest, is this package currently accessible to blind / partially sighted users? If not, could someone create an alternative output format which was?
I’m afraid I don’t know anything about how one would go about doing that, but I’d like to! Is there any good resource on the topic?
March 28, 2022, 5:22pm
This is so cool!!! really useful. Thanks a lot!!
@FedeClaudi sorry for reviving this thread, but I was curious about whether or not there is a way for Term.jl to automatically color format XML statements such as (all grey in terminal):
<posmin x="default" y="default" z="default"/>
<posmax x="default" y="default" z="default"/>
And turn them into (from Notepad++)
I.e. automatic colour formatting for XML snippets inside of Julia terminal.
The short answer is not really.
You might have seen Term used to print styled code with syntax highlight:
but the coloring is actually done by
highlights.jl, Term just prints it out. If you have a parser that takes XML statements and injects color (via Term’s markup syntax or using ANSI escape codes directly) then yeah you can do it. I don’t know much about XML, but if the syntax is fairly simple perhaps you can work out a few regex expressions to inject color into a string of XML statements.
Hope this helps