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.

OfficeCLI: The AI-Native CLI for Word, Excel, and PowerPoint Automation
June 28, 2026
OfficeCLI is a free, open-source command-line interface designed for AI agents and developers to read, edit, and automate Word, Excel, and PowerPoint files. It operates as a single binary, requiring no Office installation or dependencies. With its built-in rendering and formula engines, OfficeCLI enables high-fidelity document manipulation and visualization in headless environments.

Agent-Reach: Empower Your AI Agents with Internet Access, Zero API Fees
June 21, 2026
Agent-Reach is a powerful GitHub repository that equips AI agents with the ability to access and search the entire internet, including platforms like Twitter, Reddit, YouTube, and Bilibili. It provides a streamlined CLI experience, eliminating the need for complex API configurations and associated fees. This project ensures your AI agent can "see" and interact with web content effortlessly.

ascii-chat: Video Chat in Your Terminal with Audio, Encryption, and Media Support
June 4, 2026
ascii-chat is a unique client-server application that enables video chat directly within your terminal, supporting color, audio, and encryption. It allows multiple clients to connect, offers media streaming from files or URLs, and features a robust discovery service for easy connection. Built in C, it's a powerful and versatile tool for terminal enthusiasts.

Task: A Modern, Cross-Platform Build Tool for Streamlined Workflows
May 18, 2026
Task is an open-source, cross-platform build tool inspired by Make, designed to simplify and automate modern development workflows. It allows developers to define and run tasks using a simple YAML configuration, offering a powerful and intuitive alternative to traditional build systems. Written in Go, Task ensures fast execution and broad compatibility across various operating systems.
Source repository
Open the original repository on GitHub.