/go-ansicon

A Go library that converts ANSI escape sequences to Windows API calls

Primary LanguageGo

go-ansicon

A Go library that converts ANSI escape sequences to Windows API calls. Based on ANSICON by Jason Hood, go-colortext by David Deng and tcsh

This library follows the definition of the XTerm control sequences.

Usage

This library provides a Convert function, that reads data written to an io Writer, looks for escape sequences and executes the required Windows API calls. The rest of the data is written using the returned io Writer.

It can be used to make portable command line applications that require ANSI escape sequences and need to run on both Posix and Windows systems.

Examples

Current status

Only VT100 Mode control sequences are supported.

Currently implemented:

  • Selecting graphic rendition
  • Display reset and blank filling
  • Setting cursor position

This makes e.g. a SSH session pretty usable.