lipgloss

Lipgloss brings a CSS-like, declarative styling API to Go terminal apps, covering colors, borders, layout, and compositing for building polished TUIs.

Library
Go
vv1.1.0
11,912 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
77 /100 Good
Development Activity 76
Maintenance 72
Community 60
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
82 /100 Excellent
Architecture 85
Code Quality 90
Innovation 88
Learning Curve 65

Lipgloss is a Go library from Charm for styling terminal output with an expressive, declarative API modeled on CSS. Instead of manually concatenating ANSI escape codes, developers chain methods on a Style value — Bold, Foreground, Padding, Border, Width — and call Render to produce correctly formatted terminal text.

Beyond simple text styling, Lipgloss ships layout primitives for joining and aligning blocks of text horizontally and vertically, a cell-based compositor for layering positioned content (with mouse hit-detection for interactive layers), and companion subpackages (table, list, tree) for structured terminal output. It automatically downsamples colors to match the terminal’s actual color profile, so the same style code renders correctly whether the terminal supports true color, 256 colors, ANSI 16, or no color at all.

Lipgloss is a foundational piece of the Charm terminal UI ecosystem, commonly paired with Bubble Tea for building full interactive TUI applications, but it works equally well standalone for CLI tools that just need attractive, portable formatted output.

What You Get

  • A fluent Style builder covering color (4-bit, 8-bit, and 24-bit true color), bold/italic/underline/strikethrough formatting, and clickable terminal hyperlinks
  • CSS-style shorthand for padding, margins, and borders, including custom border character sets and multi-color gradient borders
  • Layout utilities for joining and aligning multi-line text blocks horizontally or vertically along configurable axes
  • A cell-based compositor (layer.go, canvas.go) for layering positioned content with z-index ordering and mouse click detection
  • Companion table, list, and tree subpackages for rendering structured data without hand-rolled formatting
  • Automatic color profile detection and downsampling so the same style code works across true-color, 256-color, ANSI, and no-color terminals

Common Use Cases

  • Styling output for standalone CLI tools so status messages, headers, and tables look polished without manual ANSI code juggling
  • Building the visual layer of interactive terminal UIs, typically alongside Bubble Tea, for panels, dialogs, and layouts
  • Rendering structured data — configuration summaries, diffs, comparison tables — with the table and tree subpackages
  • Producing terminal output that degrades gracefully in CI logs or non-color terminals via automatic profile downsampling
  • Compositing layered terminal “canvases” for dashboards or games that need precisely positioned, z-ordered content

Under The Hood

Architecture Lipgloss centers on Style, an immutable value type in style.go whose properties are packed into a propKey bitmask, so styles can be copied, inherited, and partially overridden (Inherit, UnsetX) without pointer aliasing bugs. Rendering fans out through platform-specific ANSI handling (ansi_unix.go/ansi_windows.go) and the github.com/charmbracelet/x/ansi package, while layout concerns are cleanly separated into join.go, align.go, and position.go. A separate compositing layer (layer.go, canvas.go) provides z-indexed, positioned content layering with mouse-click hit testing, and the table, list, and tree directories are self-contained subpackages that build on the core Style API rather than reaching into its internals — a modular structure where each concern (styling, layout, compositing, structured rendering) can be understood and changed independently.

Tech Stack Written in pure Go (module charm.land/lipgloss/v2, targeting Go 1.25) with a deliberately small dependency set: charmbracelet/x/ansi and charmbracelet/colorprofile for terminal capability detection and ANSI sequence generation, charmbracelet/ultraviolet and x/term/x/termios for terminal I/O, lucasb-eyer/go-colorful for color-space math (blending, darkening/lightening), and clipperhouse/displaywidth/rivo/uniseg for correct Unicode cell-width measurement. No web framework or runtime dependencies — this is a leaf library meant to be imported directly.

Code Quality Test files sit alongside nearly every source file (style_test.go, borders_test.go, table_test.go, tree_test.go, and more, totaling over 2,000 lines of tests), several using golden-file comparisons via charmbracelet/x/exp/golden. CI runs a dedicated coverage workflow with the race detector and reports to Coveralls, plus separate build and lint workflows and automated dependabot-sync, indicating an actively maintained quality gate rather than ad hoc testing.

What Makes It Unique Few terminal libraries commit as fully to a CSS-inspired mental model — padding/margin shorthand syntax, inheritance with explicit unset semantics, and copy-by-assignment value styles that behave like CSS classes rather than mutable builders. The automatic color-profile downsampling removes a whole class of “looks broken in some terminals” bugs, and the cell-based compositor with mouse-aware layers goes beyond simple text styling into genuine terminal UI layout, which is why it underpins much of the wider Charm TUI ecosystem.

Used by 16 apps in this directory

Go
56%
Apache 2.0

Authgear

Authentication

2,102

Open-source, self-hostable authentication platform with passkeys, biometric login, SSO, MFA, and GraphQL admin API — a full Auth0/Clerk/Firebase alternative for SaaS and mobile apps.

View details
89
Repo Health
81
Technical
68
Dependency
Built with
Go 56%
HTML 24%
TypeScript 18%
Updated yesterday
Go
75%
AGPL 3.0

Coder

Code Editors · Developer Tools · Devops

16,920

Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.

View details
91
Repo Health
90
Technical
66
Dependency
Built with
Go 75%
TypeScript 23%
Updated today
Go
33%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

12,859

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
84
Repo Health
88
Technical
63
Dependency
Built with
Go 33%
Rust 26%
C 22%
Updated today
Go
75%
Other

Flipt

Developer Tools · Devops

4,916

Git-native feature flag platform that stores, versions, and deploys feature toggles directly in your own Git repositories with no external database required.

View details
90
Repo Health
83
Technical
68
Dependency
Built with
Go 75%
TypeScript 24%
Updated yesterday
TypeScript
48%
AGPL 3.0

Grafana

Analytics · Monitoring

77,212

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
63
Dependency
Built with
TypeScript 48%
Go 47%
Updated today
Go
86%
MIT

Hatchet

AI Development · Automation · Developer Tools

8,091

A Postgres-backed orchestration engine for background tasks, AI agents, and durable workflows that replaces Redis queues and multi-datastore durable execution platforms with a single self-hostable service.

View details
88
Repo Health
83
Technical
67
Dependency
Built with
Go 86%
Updated yesterday
Go
67%
MIT

hoop

Monitoring · Security

831

A wire-protocol gateway that enforces data masking, command blocking, approval workflows, and full session recording for engineers and AI agents accessing production infrastructure.

View details
86
Repo Health
80
Technical
64
Dependency
Built with
Go 67%
Clojure 15%
JavaScript 11%
Updated today
Go
99%
Apache 2.0

klaw

AI Agents · Devops

634

kubectl for AI Agents — manage, schedule, and scale your AI workforce with a single binary that deploys in seconds.

View details
38
Repo Health
74
Technical
83
Dependency
Built with
Go 99%
Updated 6 months ago
Go
95%
MIT

cli

Developer Tools · Team Chat

17,597

The official Lark/Feishu CLI tool built for both humans and AI agents, delivering 200+ commands and 26 AI agent skills across 18 business domains from messaging and calendar to docs, sheets, and approvals.

View details
84
Repo Health
83
Technical
75
Dependency
Built with
Go 95%
Updated yesterday

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