Watch
1
0
Fork
You've already forked golang-github-noborus-tcellansi
0
No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Daniel Baumann 5e78833200
Releasing fastforward version 0.4.1-1~ffwd13+u1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2026-07-08 13:06:16 +02:00
.github/workflows Adding upstream version 0.4.1. 2026-07-08 13:00:29 +02:00
debian Releasing fastforward version 0.4.1-1~ffwd13+u1. 2026-07-08 13:06:16 +02:00
examples Adding upstream version 0.4.1. 2026-07-08 13:00:29 +02:00
go.mod Adding upstream version 0.4.1. 2026-07-08 13:00:29 +02:00
go.sum Adding upstream version 0.4.1. 2026-07-08 13:00:29 +02:00
LICENSE Adding upstream version 0.4.1. 2026-07-08 13:00:29 +02:00
README.md Adding upstream version 0.4.1. 2026-07-08 13:00:29 +02:00
toansi.go Adding upstream version 0.4.1. 2026-07-08 13:00:29 +02:00
toansi_test.go Adding upstream version 0.4.1. 2026-07-08 13:00:29 +02:00

tcellansi

Go Reference

tcellansi is a package for converting tcell styles to ANSI escape sequences.

Version Compatibility

  • For tcell v3, use the latest main branch of this repository.
  • For tcell v2, use the v0.3.1 tag:
  go get github.com/noborus/tcellansi@v0.3.1

Installation

To install the package, run:

go get github.com/noborus/tcellansi

Usage

Here is a simple example of how to use tcellansi:

package main

import (
	"github.com/gdamore/tcell/v3"
	"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 file for details.