New Console library

It was a productive weekend and I managed to put together a release of a console library.

This library makes it easy to add ANSI escape sequences to console output. Add a red background to values above a threshold, assign text colors to categories, etc. Together with the emoji library this should allow you to put together some nice looking console based reports. It doesn't do the heavy lifting but it's always nice to look good while you're working hard.

Documentation is still lacking but it basically wraps the Jansi library. You can either call specific functions like backgroundBlue, italic, etc or call render with a simple template language to render escapes. Most of the functions have a corresponding *Off function that will reset that particular attribute to the default. The functions can be called two ways, there is a zero arg call that simply renders the escape sequence for that attribute, backgroundBlue() will render a blue background and you would be responsible for calling backgroundDefault() or a multi argument call that will simply concatenate the arguments wrapped in a call to that attribute followed by a call to *Off or *Default.

c:console(c:backgroundBlue(), "Hello world", c:backgroundDefault())


c:console(c:background("hello world))

would be equivalent. c:console acts the same as the builtin function concat.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.