ANSI Terminal v0.9.0

Written in: Fantom pod: v0.9.0 Licence: ISC


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.


Install ANSI Terminal with the Fantom Pod Manager ( FPM ):

C:\> fpm install afTerminal

Or install ANSI Terminal with fanr:

C:\> fanr install -r afTerminal

To use in a Fantom project, add a dependency to

depends = ["sys 1.0", ..., "afTerminal 0.9"]


Full API & fandocs are available on the Eggbox - the Fantom Pod Repository.

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