Announcing Term.jl

Announcing Term.jl, a package inspired by WIll McGougan’s rich package in Python to produce stylized, structured output for your terminal, in Julia.

Docs: https://fedeclaudi.github.io/Term.jl/v0.2/

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
image



Renderables can be composed to create layouts. You can put almost anything in a Panel and vertically/horizontally stack multiple renderables:


image

Also Term.jl can be used to produce beautiful log and error messages and progress bars
image
image

155 Likes

this is insanely good

17 Likes

Thank you, it will keep getting better I’ve got a few more features planned :sunglasses:

14 Likes

Really impressive! :muscle:t2:

3 Likes

How well do the things like colors work with the inline results of say VSCode @pfitzseb ?

2 Likes

Probably not very well.

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.

1 Like

Thank you! A couple releases down the line Term will also include a Table functionality!

4 Likes

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.

1 Like

@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 :star_struck:.

4 Likes

For anyone that wants to stay updated on Term’s development, twitter is the best place: https://twitter.com/Federico_claudi

4 Likes

Great suggestion! Will do!

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?

one day!

Hi,

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?

1 Like

This is so cool!!! really useful. Thanks a lot!!

1 Like

@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):

<simulationdomain>
  <posmin x="default" y="default" z="default"/>
  <posmax x="default" y="default" z="default"/>
</simulationdomain>

And turn them into (from Notepad++)

I.e. automatic colour formatting for XML snippets inside of Julia terminal.

Kind regards

Hi,

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