# charmbracelet/lipgloss

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/charmbracelet-lipgloss).**

10,591 stars · 311 forks · Go · mit

## Links

- GitHub: https://github.com/charmbracelet/lipgloss
- awesome-repositories: https://awesome-repositories.com/repository/charmbracelet-lipgloss.md

## Topics

`cli` `go` `golang` `hacktoberfest` `layout` `style` `tui`

## Description

This project is a framework for composing terminal interfaces through declarative styling and a grid-based layout engine. It provides a comprehensive toolkit for building responsive command-line applications by managing ANSI escape sequences, color profiles, and text rendering to ensure consistent visual output across different terminal environments.

The library distinguishes itself through its ability to automatically detect terminal capabilities and background themes, allowing it to adjust color schemes and downsample profiles for optimal readability. It utilizes a layered composition model that supports z-indexing and relative positioning, enabling the construction of complex, nested interfaces from individual styled components.

Beyond core styling, the toolkit includes utilities for rendering structured data such as tables and trees, as well as spatial hit testing for interactive elements. It handles the complexities of terminal display by calculating the visual width of multi-byte characters, managing text wrapping, and providing support for decorative borders and color gradients.

The library is designed for integration into Go-based command-line projects, offering a fluent API for defining immutable style objects and managing terminal output. It includes built-in support for legacy Windows console environments and provides tools for inspecting and debugging visual configurations.

## Tags

### User Interface & Experience

- [Terminal User Interfaces](https://awesome-repositories.com/f/user-interface-experience/terminal-user-interfaces.md) — Provides a framework for building visually rich command line interfaces using declarative styling and layout grids.
- [Terminal Layout Engines](https://awesome-repositories.com/f/user-interface-experience/terminal-layout-engines.md) — Arranges text blocks and borders into complex grid structures that adapt to terminal dimensions.
- [Terminal Styling](https://awesome-repositories.com/f/user-interface-experience/terminal-styling.md) — Applies colors, decorations, and formatting to command line output with cross-terminal compatibility.
- [Grid Layout Engines](https://awesome-repositories.com/f/user-interface-experience/grid-layout-engines.md) — Arranges content using a virtual coordinate system with padding, margins, and alignment controls.
- [Declarative Style Objects](https://awesome-repositories.com/f/user-interface-experience/styling-theming-systems/content-styling/component-styling-tools/component-styling/declarative-style-objects.md) — Provides a fluent API for defining immutable style objects to manage visual properties declaratively.
- [Terminal Output Formatters](https://awesome-repositories.com/f/user-interface-experience/terminal-user-interfaces/rendering-output-engines/terminal-output-formatters.md) — Renders formatted text to standard output while automatically adjusting color profiles to terminal capabilities. ([source](https://github.com/charmbracelet/lipgloss/blob/main/writer.go))
- [Terminal Text Styling](https://awesome-repositories.com/f/user-interface-experience/terminal-text-styling.md) — Applies visual formatting and ANSI styles to text while handling multi-byte characters. ([source](https://github.com/charmbracelet/lipgloss/blob/main/ranges.go))
- [Terminal-Agnostic Renderers](https://awesome-repositories.com/f/user-interface-experience/terminal-user-interfaces/rendering-output-engines/terminal-agnostic-renderers.md) — Converts composed grids of terminal cells into final string representations while preserving styles. ([source](https://github.com/charmbracelet/lipgloss/blob/main/UPGRADE_GUIDE_V2.md))
- [Visual Component Composition Systems](https://awesome-repositories.com/f/user-interface-experience/visual-component-composition-systems.md) — Supports z-indexing and relative positioning to build complex, nested interfaces from individual components.
- [Adaptive Color Schemes](https://awesome-repositories.com/f/user-interface-experience/adaptive-color-schemes.md) — Automatically selects foreground colors based on detected terminal background brightness. ([source](https://github.com/charmbracelet/lipgloss/blob/main/UPGRADE_GUIDE_V2.md))
- [Measurement Tools](https://awesome-repositories.com/f/user-interface-experience/measurement-tools.md) — Calculates visual width and height of rendered text blocks by accounting for multi-cell characters. ([source](https://github.com/charmbracelet/lipgloss/blob/main/size_test.go))
- [Text Wrapping Utilities](https://awesome-repositories.com/f/user-interface-experience/terminal-user-interfaces/layout-structural-components/interface-layout-utilities/text-wrapping-utilities.md) — Manages automatic text wrapping within boundaries while preserving ANSI styles and hyperlinks. ([source](https://github.com/charmbracelet/lipgloss/blob/main/README.md))
- [Hit Testing Systems](https://awesome-repositories.com/f/user-interface-experience/hit-testing-systems.md) — Identifies visual layers at specific coordinates to enable interactive terminal interfaces and mouse input. ([source](https://github.com/charmbracelet/lipgloss/blob/main/layer.go))
- [Text Alignment](https://awesome-repositories.com/f/user-interface-experience/text-alignment.md) — Provides utilities for horizontal and vertical text alignment within defined terminal dimensions. ([source](https://github.com/charmbracelet/lipgloss/blob/main/join_test.go))

### Operating Systems & Systems Programming

- [Terminal Layout Engines](https://awesome-repositories.com/f/operating-systems-systems-programming/terminal-command-line-environments/terminal-interface-systems/terminal-interfaces/terminal-layout-engines.md) — Implements a grid-based layout engine for composing complex, multi-layered terminal interfaces.
- [ANSI Escape Sequence Renderers](https://awesome-repositories.com/f/operating-systems-systems-programming/terminal-command-line-environments/terminal-management/output-rendering-engines/ansi-escape-sequence-renderers.md) — Provides a comprehensive engine for managing and rendering ANSI escape sequences to style terminal output.
- [Terminal UI Frameworks](https://awesome-repositories.com/f/operating-systems-systems-programming/terminal-command-line-environments/terminal-interface-systems/terminal-interfaces/terminal-ui-frameworks.md) — Offers a declarative framework for styling and building structured terminal user interfaces.
- [Data Visualization Components](https://awesome-repositories.com/f/operating-systems-systems-programming/terminal-command-line-environments/terminal-interface-systems/terminal-interfaces/data-visualization-components.md) — Renders structured data like tables and trees with custom styles to improve terminal readability.
- [String Width Calculators](https://awesome-repositories.com/f/operating-systems-systems-programming/terminal-command-line-environments/terminal-management/output-rendering-engines/string-width-calculators.md) — Calculates the true display width of text by accounting for multi-byte characters and ignoring ANSI sequences.
- [Terminal Environment Detection](https://awesome-repositories.com/f/operating-systems-systems-programming/terminal-command-line-environments/terminal-environment-detection.md) — Detects terminal background themes and capabilities to dynamically adjust color schemes. ([source](https://github.com/charmbracelet/lipgloss/blob/main/query.go))
- [Terminal Environment Detectors](https://awesome-repositories.com/f/operating-systems-systems-programming/terminal-command-line-environments/terminal-management/terminal-environment-detectors.md) — Queries terminal emulators to detect supported features and environment states for adaptive rendering. ([source](https://github.com/charmbracelet/lipgloss/blob/main/terminal.go))
- [Windows Compatibility Layers](https://awesome-repositories.com/f/operating-systems-systems-programming/windows-compatibility-layers.md) — Configures legacy Windows consoles to interpret and render ANSI color sequences correctly. ([source](https://github.com/charmbracelet/lipgloss/blob/main/ansi_windows.go))
- [Border Renderers](https://awesome-repositories.com/f/operating-systems-systems-programming/terminal-command-line-environments/terminal-interface-systems/terminal-interfaces/terminal-layout-engines/border-renderers.md) — Constructs decorative frames around text blocks using customizable character sets for visual organization. ([source](https://github.com/charmbracelet/lipgloss/blob/main/borders_test.go))

### Development Tools & Productivity

- [Terminal Color Schemes](https://awesome-repositories.com/f/development-tools-productivity/terminal-shell-cli/terminal-cli-enhancements/shell-terminal-utilities/general-enhancements-tooling/terminal-utilities/appearance-sessions/terminal-color-schemes.md) — Detects terminal background themes and capabilities to adjust foreground colors for optimal readability.
- [Terminal Layout Engines](https://awesome-repositories.com/f/development-tools-productivity/terminal-layout-engines.md) — Manages fixed-size grids for precise placement and manipulation of character cells. ([source](https://github.com/charmbracelet/lipgloss/blob/main/canvas_test.go))

### System Administration & Monitoring

- [Terminal Capability Detectors](https://awesome-repositories.com/f/system-administration-monitoring/terminal-capability-detectors.md) — Queries host environments to detect terminal capabilities and adapt color profiles accordingly.

### Software Engineering & Architecture

- [Hierarchical Data Structures](https://awesome-repositories.com/f/software-engineering-architecture/hierarchical-data-structures.md) — Generates formatted tables, nested lists, and hierarchical trees with dynamic formatting based on data depth. ([source](https://github.com/charmbracelet/lipgloss#readme))

### Graphics & Multimedia

- [Gradient Generators](https://awesome-repositories.com/f/graphics-multimedia/graphics-and-media/gradient-generators.md) — Generates one-dimensional or two-dimensional color gradients for text and borders. ([source](https://github.com/charmbracelet/lipgloss/blob/main/README.md))
