-
Daniel Deutsch authored
go-figure now prints in color! Fancy! This change updates the README with a proper section. Additionally, some of the language was incorrect with the neat addition of bindata. This is now updated.
82e28795
Go Figure
Description
Go Figure prints beautiful ASCII art from text. It supports FIGlet files, and most of its features.
This package was inspired by the Ruby gem artii, but built from scratch and with a different feature set.
Installation
go get github.com/common-nighthawk/go-figure
Basic Example
package main
import("github.com/common-nighthawk/go-figure")
func main() {
myFigure := figure.NewFigure("Hello World", "", true)
myFigure.Print()
}
_ _ _ _ __ __ _ _
| | | | ___ | | | | ___ \ \ / / ___ _ __ | | __| |
| |_| | / _ \ | | | | / _ \ \ \ /\ / / / _ \ | '__| | | / _` |
| _ | | __/ | | | | | (_) | \ V V / | (_) | | | | | | (_| |
|_| |_| \___| |_| |_| \___/ \_/\_/ \___/ |_| |_| \__,_|
You can also make colorful figures:
func main() {
myFigure := figure.NewColorFigure("Hello World", "", "green", true)
myFigure.Print()
}
Documentation
Create a Figure
There are three ways to create a Figure. These are--
the method func NewFigure
,
the method func NewColorFigure
, and
the method func NewFigureWithFont
.
Each constructor takes the arguments: the text, font, and strict mode. The "color" constructor takes a color as an additional arg. The "with font" specifies the font differently. The method signature are:
func NewFigure(phrase, fontName string, strict bool) figure
func NewColorFigure(phrase, fontName string, color string, strict bool) figure
func NewFigureWithFont(phrase string, reader io.Reader, strict bool) figure
NewFigure
requires only the name of the font, and uses the font file shipped
with this package stored in bindata.
If passed an empty string for the font name, a default is provided. That is, these are both valid--
myFigure := figure.NewFigure("Foo Bar", "", true)