Package ansi provides raw ANSI sequence helpers for Go.
.
ANSI Writer
.
import "github.com/muesli/ansi"
.
w := ansi.Writer{Forward: os.Stdout}
w.Write([]byte("\x1b[31mHello, world!\x1b[0m"))
w.Close()
.
Compressor
.
The ANSI compressor eliminates unnecessary/redundant ANSI sequences.
.
import "github.com/muesli/ansi/compressor"
.
w := compressor.Writer{Forward: os.Stdout}
w.Write([]byte("\x1b[31mHello, world!\x1b[0m"))
w.Close()
Installed Size: 30.7 kB
Architectures: all