go-figure

Renders FIGlet-style ASCII art banners from plain text in Go, with color and scroll/blink/dance animations for terminal output.

Library
Go
vv0.0.0-20210622060536-734e95fb86be
751stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
32/100Needs Attention
Development Activity0
Maintenance0
Community40
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
58/100Fair
Architecture65
Code Quality35
Innovation65
Learning Curve65

Go Figure is a small Go library that turns plain text into large ASCII art banners, in the style of the classic FIGlet program. It ships with the standard library of FIGlet .flf font files compiled directly into the binary via a generated bindata.go, so there’s no external font directory to manage at runtime — a single go get and import is enough to start rendering banners.

Beyond static output, the library adds a handful of terminal-animation helpers not found in the original FIGlet: Scroll slides the banner left or right, Blink flashes it on and off, and Dance alternates two staggered copies of the phrase for a jittering effect. Output can be printed directly to stdout, written to any io.Writer (useful for serving a banner over HTTP), or captured as a plain or ANSI-colored string. It’s aimed at CLI tools and scripts that want a fun startup banner or splash screen without pulling in a heavier terminal UI dependency.

What You Get

  • Three constructors — NewFigure, NewColorFigure, and NewFigureWithFont — covering plain, colored, and custom-font banner creation
  • Over 150 bundled FIGlet .flf fonts compiled into the binary, selectable by name with no external files to ship
  • Terminal animation helpers — Scroll, Blink, and Dance — for CLI splash screens and startup banners
  • Output as a direct terminal print, an io.Writer target, or a captured plain/ANSI-colored string
  • Strict or lenient handling of non-ASCII input, either panicking or substituting a ? placeholder

Common Use Cases

  • Printing a stylized startup banner when a CLI tool boots
  • Adding a colored ASCII logo to a Go-based terminal application’s help or version output
  • Writing an ASCII art banner into an HTTP response as a novelty landing page
  • Building a quick animated terminal demo or splash screen for a script

Under The Hood

Architecture The package is organized into a handful of small, single-purpose files: figure.go defines the core figure type and the character-to-glyph rendering logic in Slicify, font.go owns font loading and parsing of FIGlet metadata lines, figlet-parser.go holds the low-level FIGlet header-parsing helpers (height, baseline, hardblank, reverse flag), and public_methods.go layers the public printing and animation API (Print, Scroll, Blink, Dance, Write) on top of the core figure. The bundled fonts live in a separately generated bindata.go produced by a go-bindata-style asset compiler, keeping font data out of the hand-written source. This is a flat, single-package design appropriate for its scope — there is no internal layering beyond this file-level separation, and swapping the core glyph-rendering approach in Slicify would touch every public method that depends on it.

Tech Stack Go Figure has zero third-party runtime dependencies — everything is built on the standard library (bufio, bytes, io, log, path, reflect, strconv, strings, time, fmt). There is no go.mod in the repository, reflecting its age and pre-Go-modules go get installation model rather than a modern module-aware setup. Font assets are embedded via a large generated bindata.go file rather than Go’s native embed package, which postdates this project’s font-bundling approach.

Code Quality Test coverage is thin — a single figure_test.go containing two Go Example-style tests that assert exact banner output for two fonts, with no broader unit tests around font parsing, animation timing, or edge cases like empty input. Error handling favors log.Fatal/panic over returned errors (an invalid color or non-ASCII strict-mode input crashes the calling program rather than surfacing a recoverable error), which is a dated pattern for a library meant to be embedded in other programs. There is no linter configuration and CI is limited to a now-inactive Travis badge in the README.

API Design The public surface is intentionally small and easy to pick up: one constructor call (NewFigure(phrase, fontName, strict)) and a .Print() produce a banner in two lines of code, with an empty font name falling back to a sensible default. Colored and custom-font variants follow the same constructor shape, keeping the mental model consistent. The playful animation methods (Scroll, Blink, Dance) extend the same figure value without introducing new types, though they block the calling goroutine for their full duration with no cancellation mechanism, which limits their use outside of simple CLI demos.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search