ANSI TerminalUser Guide
Overview
An FWT widget that prints ANSI escape sequences.
Features:
- 256 Colour VGA palette or full colour
- Foreground and background colours, palette index and full colour
- Bold, italic, underline, and crossed out fonts
- Cursor commands for up, down, left, right, absolute, save, restore
- Clear commands for line and screen
AnsiTerminal
wraps a RichText
widget and provides methods to print ANSI escape sequences.
The AnsiBuf
class provides convenient methods for generating ANSI escape sequences.
Quick Start
- Create a text file called
Example.fan
using gfx::Size using fwt::Window using afTerminal class Example { Void main() { term := AnsiTerminal() ansi := AnsiBuf() .fgIdx( 9).print("RED\n").reset .fgIdx(10).print("GREEN\n").reset .fgIdx(12).print("BLUE\n").reset .underline.print("Underline").reset Window { it.title = "ANSI Terminal" it.size = Size(320, 200) it.add(term.richText) it.onOpen.add |->| { term.print(ansi) } }.open } }
- Run
Example.fan
as a Fantom script from the command line:C:\> fan Example.fan