Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
A collection of useful ANSI escape sequences and helper functions
ResourceFunction["ANSITools"][token] generates ANSI escape codes corresponding to token. | |
ResourceFunction["ANSITools"]["MoveCursor", args] generates ANSI escape codes moving the terminal cursor as directed by args. | |
ResourceFunction["ANSITools"]["Style", text, styleOptions] generates ANSI escape codes styling text using the styleOptions provided. | |
ResourceFunction["ANSITools"]["Style", styleOptions] operator form of Style able to applied directly to text strings. |
"MoveCursor" | row,column or direction,amount | move the cursor to a specified position or by a specified amount |
"Style" | text, styleoptions | style text according to the styleoptions |
FontColor | Default | change the foreground color of text |
FontWeight | Default | change the text display mode |
Background | Default | change the background color of text |
"SavePosition" | save the current cursor postion |
"LoadPosition" | load the last saved cursor position |
"RequestPosition" | request the cursor position (reports as ESC[{row};{col}R) |
"Clear" | clear the entire screen |
"ClearToStart" | clear from cursor to start of the screen |
"ClearToEnd" | clear from cursor to end of the screen |
"ClearLine" | clear the entire line |
"ClearLineToStart" | clear from cursor to start of the line |
"ClearLineToEnd" | clear from cursor to end of the line |
"Tokens" | list all known tokens |
List all known tokens:
In[1]:= | ![]() |
Out[1]= | ![]() |
Style some text printed in the console:
Commands can be linked together using StringJoin. Delete the last 10 rows printed in the terminal:
Use the operator form of "Style":
In[2]:= | ![]() |
Out[3]= | ![]() |
ANSITools will always output some string containing ANSI escape sequences:
In[4]:= | ![]() |
Out[4]= | ![]() |
Wolfram Language 12.0 (April 2019) or above
This work is licensed under a Creative Commons Attribution 4.0 International License