anstyle for Go
🦀 Rust anstyle crate ported to Go
style := anstyle.NewStyle().
Bold().
Underline().
Foreground(anstyle.ANSIColorRed)
fmt.Printf("%vHello world!%v\n", style, style.RenderReset())
|
See the example
|
Installation
go get github.com/jcbhmr/go-anstyle/anstyle
Usage
style := anstyle.NewStyle().
Bold().
Underline().
Foreground(anstyle.ANSIColorRed)
fmt.Printf("%vHello world!%v\n", style, style.RenderReset())
Development
To get started after cloning this repository you can run the example:
go run ./examples/dump-style.go
This project tries to bring some of the Rust-isms from the anstyle crate to Go. That means things like Option<T>
are represented as *T
or (T, bool)
and Result<T, E>
is (T, error)
. I don't really know if that's the best way to represent these things in Go, but it's what I'm doing for now. If you have better ideas or suggestions, please tell me! ❤️