On Friday, July 13, 2018 at 9:38:01 PM UTC+2, Jay wrote:
> I would like to view notes within a Tcl script using the less command and ANSI colors.
The keyword ANSI colors reminds me of the nice little ansifilter project by André Simon:
http://andre-simon.de/doku/ansifilter/en/ansifilter.php
It is not your exact use case, but it could help to
* strip ANSI color codes from text or
* generate other formats (e.g. HTML if your App features a browser anyway, or LaTeX if you want to generate PDF reports, ...).
It has three modes: GUI, command line, Tcl; I am not using the GUI.
The Tcl package allows something like this:
expect:~$ package require ansifilter
0.1
expect:~$ ansifilter::tex_escape "\033\[97m RUSH \033\[96m2112"
{\color[rgb]{1,1,1}~RUSH~}{\color[rgb]{0,1,1}2112\hspace*{\fill}\\
}
expect:~$
Maybe that helps anyone :-)
Martin
Disclaimer: I contributed the (unfinished) Tcl mode,
https://gitlab.com/saalen/ansifilter/tree/master/src/tcl