VT [](https://godoc.org/github.com/xyproto/vt) [](https://raw.githubusercontent.com/xyproto/vt/main/LICENSE) [](https://goreportcard.com/report/github.com/xyproto/vt)
May 5, 2026 · View on GitHub
This is a package for dealing with terminal emulators.
- Supports colors and attributes, including 256-color and true-color (24-bit RGB).
- Supports color operations such as
Lighten,Darken,BlendandContrastRatio. - Supports the
NO_COLORenvironment variable. - Supports HTML-like tagged color output, such as
<red>hello</red>. - Supports Linux, macOS, other Unix-like systems, and Windows.
- Can detect the terminal size.
- Can get key-presses, including arrow keys (252, 253, 254, 255), pgup/pgdn (251, 250), F1–F12, Home, End, Delete, Shift-Tab, and modifier combinations (Alt, Ctrl, Shift) on xterm-class terminals.
- Has a Canvas struct, for drawing only the updated lines to the terminal, with synchronized updates and wide character support.
- Can render a Canvas to an
image.Image. - Can detect terminal capabilities, such as
Multiplexed(),XtermLike(),Has256Colors()andGetBackgroundColor(). - Has
NewTTYFromReader, for scripted or test input without a real terminal. - Could be used for making an alternative to the
dialogorwhiptailutilities.
Images

Screen recording of the shooter example, where you can control a small character with the arrow keys and shoot with space.

Screen recording of the menu example, which uses VT100 terminal codes and demonstrates a working menu.
![]()
A physical VT100 terminal. Photo by Jason Scott, CC BY 2.0
Requirements
- Go 1.25 or later.
Features and limitations
- Can detect letters, arrow keys, F1–F12, Home, End, Delete, Shift-Tab, and modifier combinations such as Ctrl, Alt and Shift combined with arrow keys, on xterm-class terminals.
- Resizing the terminal when using the Canvas struct may cause artifacts, for a brief moment.
- Holding down a key may trigger key repetition which may speed up the main loop.
- Modifier key combinations are only emitted by xterm-class terminals; use
HasAltArrows(),HasCtrlArrows()orHasShiftArrows()to check.
Another example
See cmd/move for a more advanced example, where a character can be moved around with the arrow keys.
General info
- License: BSD-3
- Version: 1.9.11
- Author: Alexander F. Rødseth <xyproto@archlinux.org>