Lipgloss: Declarative Terminal Styling for Go Applications
This repository profile is provided by osrepos.com, an open source repository discovery platform.
Summary
Lipgloss is a powerful Go library by Charmbracelet that provides a declarative way to style terminal output and create beautiful TUI layouts. Inspired by CSS, it simplifies the process of adding colors, borders, padding, and more to your command-line applications. This tool is ideal for developers looking to enhance the visual appeal and user experience of their terminal-based projects.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
Lipgloss, from the creators at Charmbracelet, is a robust Go library designed to bring elegant and structured styling to your terminal applications. It offers a declarative, CSS-like approach to defining styles, making it intuitive for developers to create visually appealing layouts and text. Whether you're building a simple CLI tool or a complex Terminal User Interface (TUI), Lipgloss provides the tools to make your output shine.
Installation
To integrate Lipgloss into your Go project, simply use the go get command:
go get github.com/charmbracelet/lipgloss
Examples
Lipgloss offers a wide array of styling options, from basic text formatting to complex layout management.
Basic Styling
Define styles with methods like Bold, Foreground, Background, and Padding.
import "github.com/charmbracelet/lipgloss"
var style = lipgloss.NewStyle().
Bold(true).
Foreground(lipgloss.Color("#FAFAFA")).
Background(lipgloss.Color("#7D56F4")).
PaddingTop(2).
PaddingLeft(4).
Width(22)
fmt.Println(style.Render("Hello, kitty"))
Colors
Lipgloss supports various color profiles, automatically degrading colors if the terminal doesn't support the full range.
- ANSI 16 colors (4-bit)
lipgloss.Color("5") // magenta lipgloss.Color("9") // red lipgloss.Color("12") // light blue - ANSI 256 Colors (8-bit)
lipgloss.Color("86") // aqua lipgloss.Color("201") // hot pink lipgloss.Color("202") // orange - True Color (24-bit)
lipgloss.Color("#0000FF") // good ol' 100% blue lipgloss.Color("#04B575") // a green lipgloss.Color("#3C3C3C") // a dark gray - Adaptive Colors: Specify colors for light and dark backgrounds.
lipgloss.AdaptiveColor{Light: "236", Dark: "248"}
Inline Formatting
Apply common ANSI text formatting options.
var style = lipgloss.NewStyle().
Bold(true).
Italic(true).
Faint(true).
Blink(true).
Strikethrough(true).
Underline(true).
Reverse(true)
Block-Level Formatting
Control spacing with padding and margins, similar to CSS.
// Padding shorthand
lipgloss.NewStyle().Padding(2) // 2 cells on all sides
// Margins shorthand
lipgloss.NewStyle().Margin(2, 4) // 2 cells top/bottom, 4 cells left/right
Borders
Easily add various border styles, colors, and positions.
// Add a purple, rectangular border
var style = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
BorderForeground(lipgloss.Color("63"))
// Set a rounded, yellow-on-purple border to the top and left
var anotherStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.RoundedBorder()).
BorderForeground(lipgloss.Color("228")).
BorderBackground(lipgloss.Color("63")).
BorderTop(true).
BorderLeft(true)
Joining Paragraphs
Combine text blocks horizontally or vertically with alignment options.
// Horizontally join three paragraphs along their bottom edges
lipgloss.JoinHorizontal(lipgloss.Bottom, paragraphA, paragraphB, paragraphC)
// Vertically join two paragraphs along their center axes
lipgloss.JoinVertical(lipgloss.Center, paragraphA, paragraphB)
Rendering Tables
The lipgloss/table sub-package allows for structured data presentation.
import "github.com/charmbracelet/lipgloss/table"
rows := [][]string{
{"Chinese", "??", "??"},
{"Japanese", "?????", "??"},
}
t := table.New().
Border(lipgloss.NormalBorder()).
Headers("LANGUAGE", "FORMAL", "INFORMAL").
Rows(rows...)
fmt.Println(t)
Rendering Lists
Create formatted lists with the lipgloss/list sub-package, supporting nesting and custom enumerators.
import "github.com/charmbracelet/lipgloss/list"
l := list.New("A", "B", "C")
fmt.Println(l)
// Nested list example
l = list.New(
"A", list.New("Artichoke"),
"B", list.New("Baking Flour", "Bananas"),
)
fmt.Println(l)
Rendering Trees
Visualize hierarchical data using the lipgloss/tree sub-package.
import "github.com/charmbracelet/lipgloss/tree"
t := tree.Root(".").
Child("A", "B", "C")
fmt.Println(t)
// Nested tree example
t = tree.Root(".").
Child("macOS").
Child(
tree.New().
Root("Linux").
Child("NixOS"),
)
fmt.Println(t)
Why Use Lipgloss?
Lipgloss simplifies the creation of rich, engaging terminal interfaces. Its declarative API, inspired by web styling, allows developers to focus on the structure and content of their applications rather than the complexities of ANSI escape codes. It automatically handles color degradation, supports adaptive colors for different terminal themes, and provides powerful layout utilities. For those building TUIs with Bubble Tea, Lipgloss is an excellent companion for crafting beautiful views.
Links
- GitHub Repository: https://github.com/charmbracelet/lipgloss
- GoDoc Documentation: https://pkg.go.dev/github.com/charmbracelet/lipgloss?tab=doc
Related repositories
Similar repositories that may be relevant next.

Agent Factory: Generate AI Agents with Natural Language Descriptions
September 3, 2026
Agent Factory, developed by Mozilla-AI, is a powerful tool designed to generate AI agents and workflows. It allows users to describe tasks in natural language, which it then transforms into executable Python code for agentic workflows. Leveraging the Model Context Protocol (MCP) and the any-agent library, it simplifies the creation of complex AI solutions.

DeepSeek-Reasonix: Your AI Coding Agent for the Terminal
August 26, 2026
DeepSeek-Reasonix is an AI coding agent designed for your terminal, offering a stable and persistent environment for development tasks. Engineered with prefix-cache stability, it allows you to leave it running for continuous autonomous operation. This tool integrates seamlessly into various workflows, from CLI to VS Code, enhancing productivity with AI assistance.

goose: Your Native Open Source AI Agent for Code and Workflows
August 9, 2026
goose is an open source, extensible AI agent designed to run natively on your machine, offering capabilities beyond simple code suggestions. It supports installation, execution, editing, and testing with a wide range of Large Language Models. Built in Rust, goose provides a desktop app, CLI, and API, making it a versatile tool for various tasks from coding to data analysis.
Destructive Command Guard (dcg): Protecting AI Agents from Dangerous Commands
July 11, 2026
The Destructive Command Guard (dcg) is a high-performance hook designed to prevent AI coding agents from executing dangerous git and shell commands. Built in Rust, dcg intercepts and blocks catastrophic operations like `git reset --hard` or `rm -rf`, offering clear explanations and safer alternatives. It provides a crucial safety layer for developers working with tools like Claude Code, Codex CLI, and GitHub Copilot.
Source repository
Open the original repository on GitHub.
15 counted GitHub visits