tcell screen reproduced as ANSI escape sequences with tcellansi
Posted on:
Overview
tcellansi is a Go library that converts screen styles drawn with tcell into ANSI escape sequences to make them easier to handle.
Key features
- Supports
tcellv3 (v2 can be used with the appropriate build tag) - Converts
tcellstyles into ANSI escape sequences - Can convert a specified screen region to strings that include ANSI escape sequences
Installation
Example when using Go Modules:
Or add the required package to your go.mod.
Quick usage
Below is a minimal example. Replace function names and usage with the actual ones from the repository as needed.
Example: converting a tcell style
This prints “Hello world!” in red text on a blue background.
Example: extracting a screen region
After the tcell screen is shown, pressing any key will exit and then print the tcell screen contents with ANSI escape sequences.
Links
- Repository: https://github.com/noborus/tcellansi
- Samples and README: see the repository README

