Reading ANSI escape sequences is nitty gritty and very easy to get wrong. I am after a library that includes an abstraction for reading escaped sequences preferrably as instances of some nice type. It would be nice if the library offered strongly types rather than everything is a strong and good luck do the stuff yourself.
Any pointers to a foss library would be appreciated.
A similar question A library to convert ANSI escapes (terminal formatting/color codes) to HTML which seems to have a similar motivation also remains unanswered.
A character with a backslash (\) just before it is an escape sequence or escape character.
However, the Java compiler treats the "\b" literal as a Java escape sequence, and the string WORDS silently compiles to a regular expression that checks for a single backspace character.
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text.
You may want to take a look at Jansi.
Here is the homepage and github repo
I hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With