talira

Lip Gloss

Style definitions for nice terminal layouts

open sourceMITfree

Lip Gloss is a Go library for styling terminal output with a declarative, CSS-like API: you build a style (bold, colours, padding, borders, width, alignment) and render strings with it. It downsamples colours to what the terminal supports, handles inline formatting, hyperlinks, wrapping and tabs, and has utilities for joining, placing and measuring blocks of text, plus a table rendering package. It is built with TUIs in mind and works with Bubble Tea.

Problems it solves

  • style terminal output in Go with colours, borders and padding without hand-writing escape codes
  • lay out boxes and columns side by side in a terminal UI
  • render a nicely formatted table in a Go command-line tool

Features

  • CSS-like style definitions for terminal text
  • colour downsampling to the terminal's profile
  • borders, padding, alignment and wrapping
  • joining and placing text blocks
  • table rendering

Alternatives

The same job

These do what Lip Gloss does.

  1. color (Go) Coloured terminal output for Go with ANSI escape codes
  2. tablewriter Text tables for Go in ASCII, Unicode, Markdown or HTML
  3. go-colorable Colorable writer for Windows
  4. go-isatty isatty for Go: tell whether output goes to a terminal

Compare Lip Gloss with the top 3