| 1 |
# ansi |
| 2 |
|
| 3 |
[](https://github.com/muesli/ansi/releases) |
| 4 |
[](https://github.com/muesli/ansi/actions) |
| 5 |
[](https://coveralls.io/github/muesli/ansi?branch=master) |
| 6 |
[](https://goreportcard.com/report/muesli/ansi) |
| 7 |
[](https://pkg.go.dev/github.com/muesli/ansi) |
| 8 |
|
| 9 |
Raw ANSI sequence helpers |
| 10 |
|
| 11 |
## ANSI Writer |
| 12 |
|
| 13 |
```go |
| 14 |
import "github.com/muesli/ansi" |
| 15 |
|
| 16 |
w := ansi.Writer{Forward: os.Stdout} |
| 17 |
w.Write([]byte("\x1b[31mHello, world!\x1b[0m")) |
| 18 |
w.Close() |
| 19 |
``` |
| 20 |
|
| 21 |
## Compressor |
| 22 |
|
| 23 |
The ANSI compressor eliminates unnecessary/redundant ANSI sequences. |
| 24 |
|
| 25 |
```go |
| 26 |
import "github.com/muesli/ansi/compressor" |
| 27 |
|
| 28 |
w := compressor.Writer{Forward: os.Stdout} |
| 29 |
w.Write([]byte("\x1b[31mHello, world!\x1b[0m")) |
| 30 |
w.Close() |
| 31 |
``` |