ANSI TerminalUser Guide


An FWT widget that prints ANSI escape sequences.


  • 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

  1. Create a text file called
    using gfx::Size
    using fwt::Window
    using afTerminal
    class Example {
        Void main() {
            term := AnsiTerminal()
            ansi := AnsiBuf()
                .fgIdx( 9).print("RED\n").reset
            Window {
                it.title = "ANSI Terminal"
                it.size = Size(320, 200)
                it.onOpen.add |->| {
  2. Run as a Fantom script from the command line:
    C:\> fan

    ANSI Terminal Example