https://github.com/noborus/tcellansi
tcellansi converts tcell styles to ANSI escape sequences, enabling styled terminal output with ease
https://github.com/noborus/tcellansi
escape-sequences go tcell
Last synced: 6 months ago
JSON representation
tcellansi converts tcell styles to ANSI escape sequences, enabling styled terminal output with ease
- Host: GitHub
- URL: https://github.com/noborus/tcellansi
- Owner: noborus
- License: mit
- Created: 2025-03-12T03:07:41.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-20T07:50:53.000Z (7 months ago)
- Last Synced: 2025-03-30T07:57:01.172Z (7 months ago)
- Topics: escape-sequences, go, tcell
- Language: Go
- Homepage:
- Size: 21.5 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tcellansi
[](https://pkg.go.dev/github.com/noborus/tcellansi)
`tcellansi` is a package for converting [tcell](https://github.com/gdamore/tcell) styles to ANSI escape sequences.
## Installation
To install the package, run:
```sh
go get github.com/noborus/tcellansi
```## Usage
Here is a simple example of how to use `tcellansi`:
```go
package mainimport (
"github.com/gdamore/tcell/v2"
"github.com/noborus/tcellansi"
)func main() {
// Initialize tcell screen
screen, _ := tcell.NewScreen()
screen.Init()// Create a style
style := tcell.StyleDefault.Foreground(tcell.ColorRed).Background(tcell.ColorBlack)// Convert the style to ANSI escape sequence
ansiSeq := tcellansi.ToAnsi(style)
screen.Fini()println(ansiSeq + "Hello world!")
}
```## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.