chalk for Go

github.com/malcolmston/chalk

Terminal string styling done right — plus prompts & figlet.

 GitHubports chalk/chalk

Chainable, immutable ANSI styling (16 / 256 / truecolor) with automatic capability degradation and NO_COLOR / FORCE_COLOR support. Includes chalk/prompts (inquirer-style interactive prompts) and chalk/figlet (ASCII-art banners with bundled fonts, gradients and rainbow).

Install

shell
$ go get github.com/malcolmston/chalk

Quick start

main.go
import "github.com/malcolmston/chalk"

fmt.Println(chalk.New().Red().Bold().Sprint("error!"))
fmt.Println(chalk.Green("ok"))
fmt.Println(chalk.New().Hex("#ff8800").Underline().Sprint("orange"))

Features

  • Chainable styles: chalk.New().Red().Bold().Sprint("x")
  • Modifiers (bold, dim, italic, underline, inverse, strikethrough …) and bg colors
  • Truecolor / 256-color: RGB, Hex, Ansi256, auto-degrading
  • chalk.Strip and chalk.VisibleLength helpers
  • chalk/prompts — input, confirm, select, multiselect, password (raw-mode TTY)
  • chalk/figlet — FIGfont rendering, bundled distinct fonts, gradient & rainbow coloring
chalk