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.
- color (Go) Coloured terminal output for Go with ANSI escape codes
- tablewriter Text tables for Go in ASCII, Unicode, Markdown or HTML
- go-colorable Colorable writer for Windows
- go-isatty isatty for Go: tell whether output goes to a terminal
