~exitb/retrofit

ANSI art adapter for the modern terminal
5b189c4c — exitb 5 years ago
Fix reported version
1d1f135e — exitb 5 years ago
Add info about Windows console
fd4acdd7 — exitb 5 years ago
Add README, remove TODO

clone

read-only
https://git.sr.ht/~exitb/retrofit
read/write
git@git.sr.ht:~exitb/retrofit

You can also use your local clone with git send-email.

#Retrofit

Retrofit is an ANSI art adapter for the modern terminal. It uses a series of transformations to make it possible to view ANSI art pieces in a regular Unix-like terminal and Windows console (see below for details).

Rather than recreating the whole picture within an in-memory virtual terminal, retrofit uses the actual terminal as a live buffer. That makes it possible to view the art piece at limited baud, with accurate timing. It also correctly handles drawing out-of-order and full-blown ansimations.

#Features

  • Various adaptations of encoding and ANSI escape sequence behavior
  • Independence of the underlying terminal color scheme and dimensions
  • Color transformations that make it match the original palette closer
  • Accurate baud limiting
  • Support for iCE colors
  • Support for PabloDraw 24-bit color codes
  • Ability to limit screen height, while correctly handling long-scrolling pictures

#Demo

Check out Dispenser for a quick live-demo!

#Usage

Basic usage involves stating the ANSI file as a running parameter:

$ retrofit example.ans

You can also pipe into retrofit:

$ curl -s https://example.com/example.ans | retrofit

#Baud limiting

Limit the baud count with the -b parameter:

$ retrofit -b 9600 example.ans

Note that this feature behaves erratically in certain environments, like within virtual machines. This issue is tracked here.

#24-bit color mode

For best accuracy of the original color palette, as well as support for PabloDraw color codes, use 24-bit mode:

$ retrofit -c 24bit example.ans

#Windows console support

Current Windows 10 console is able to view ANSI art pieces correctly, but user needs to enable the VT support and run chcp 65001 command before running retrofit.

Note that terminal Windows Subsystem for Linux works out of the box.

#Building from source

Retrofit is built with Rust. It requires Rust toolset to build from source. Once available:

$ git clone https://git.sr.ht/~exitb/retrofit
$ cd retrofit/
$ cargo install --path .

#License

Roam is licensed under ISC.