CLI tool
charmbracelet/glamour avatar
charmbracelet/glamour

Glamour: stylesheet-driven Markdown rendering for ANSI terminals

Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️

3,716 stars331 forksGoMIT

At a glance

What is it?
Glamour is Charm's MIT-licensed Go library rendering Markdown documents and templates on ANSI-compatible terminals through stylesheets, with dark and light defaults, a gallery of styles, word-wrap control and environment-driven configuration via GLAMOUR_STYLE. Its v2 module is consumed by Glow and the official GitHub, GitLab and Gitea CLIs, and color downsampling delegates to Lip Gloss.
Who is it for?
Use Glamour when a Go CLI application needs to render Markdown, issue bodies, README files, templates, with styled output on terminals, and when the styling should be declarative and swappable rather than hard-coded ANSI sequences. It renders pure output for a given input, so pair it with Lip Gloss when terminal capability detection matters.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 8 days ago.
What is it written in?
Mainly Go, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 27, 2026, and from our analysis. They are not legal advice.

Editorial analysis

Stylesheets as the rendering contract

Glamour is stylesheet-based markdown rendering for CLI apps, letting applications render markdown documents and templates on ANSI-compatible terminals, with the choice of creating a custom stylesheet or using one of the stylish defaults. The one-call API makes the case:

go
import "charm.land/glamour/v2"

out, err := glamour.Render(in, "dark")
fmt.Print(out)

with the stylesheet model separating what is rendered from how it looks, element styles living in JSON-like definitions rather than scattered formatting calls, so a terminal application inherits theming the way a web app inherits CSS. The NewTermRenderer constructor accepts options for the cases needing more control:

go
r, _ := glamour.NewTermRenderer(
    // wrap output at specific width (default is 80)
    glamour.WithWordWrap(40),
)

out, err := r.Render(in)
fmt.Print(out)

Word wrap, and the purity trade

The custom renderer example shows the main knob, WithWordWrap at 40, with a comment noting the default is 80, the line width every terminal style assumes. A more interesting section addresses color downsampling, since the renderer is designed to be pure and always produce the same output for the same input, it has no access to the terminal's capabilities, meaning color downsampling is not performed by default. The prescribed remedy is Lip Gloss, Charm's styling library, whose Print function downsamples colors based on what the terminal actually supports, the example rendering with Glamour then passing the output through lipgloss. The division of labor is deliberate, deterministic rendering in one library, environment adaptation in another.

Three ways to choose a style

The styles documentation enumerates three options for custom styling. Calling glamour.Render with the desired style name directly. Setting the GLAMOUR_STYLE environment variable to a style name or a file location and calling glamour.RenderWithEnvironmentConfig. Or setting GLAMOUR_STYLE and passing glamour.WithEnvironmentConfig to a custom renderer, the variant for applications that build their renderer once. The environment variable path is what makes the library user-configurable, an end user exports their preferred style or points at their own file, and the application honors it without a flag, the convention Glow and the other consumers rely on. The styles gallery in the repository holds the built-in set, with the styles directory's documentation teaching custom style creation.

Adopted by the CLIs people use daily

The glamourous projects list is the strongest endorsement available in this niche. Glow, Charm's own markdown renderer for the command line. The GitHub CLI, GitHub's official command line tool. The GitLab CLI, GitLab's official command line tool. Gitea's tea CLI. And Meteor, a plugin-driven metadata collection framework. Three of the five are the official CLIs of the major Git forges, meaning millions of developers have read issue bodies and README files through Glamour's rendering without knowing its name, and the issues-and-releases rendering those tools do is exactly the Markdown-heavy, terminal-bound workload the library was built for.

goldmark, chroma and bluemonday underneath

The dependency list names the pipeline. goldmark is the Markdown parser, with goldmark-emoji beside it for emoji shortcodes. chroma provides syntax highlighting for code blocks, its regexp2 dependency supporting the more complex highlighting patterns. bluemonday sanitizes HTML, the safety layer for rendering untrusted documents in a terminal where escape sequences can do more than look wrong. Charm's own x/ansi handles the escape code generation, and Lip Gloss v2 sits beside it as the styling and downsampling layer. The indirect dependencies fill in width calculation, color profiles and terminfo, the unglamorous machinery of correct terminal output, and the whole set is pinned under the module path charm.land/glamour/v2 on Go 1.25.

The v2 transition, documented

The repository carries an UPGRADE_GUIDE_V2.md at its root, the artifact of the library's version 2 transition, where the module path moved to charm.land/glamour/v2 and the rendering pipeline was rebuilt on the newer Charm foundations. The release history shows the shape, v0.10.0 in April 2025 as the last of the old line, then v2.0.0 on 2026-03-09 and v2.0.1 on 2026-06-12, with the repository pushed 2026-09-22. Golden-file testing through charmbracelet's x/exp/golden guards the rendering output, the correct test type for a library whose product is exactly what appears on screen, and the examples directory holds runnable projects for helloworld, custom renderers, stdin-stdout flows and styled variants.

Part of Charm, tested like a Charm project

The footer places Glamour in the Charm ecosystem, part of charm.sh, with the community channels on Twitter, the Fediverse and Discord, and the bilingual sign-off, Charm loves open source. The repository's tooling follows the organization's standards, golangci-lint configuration, a Taskfile for task running, goreleaser for release packaging, and a gallery.sh script rendering the style gallery, the self-demonstrating documentation a styling library owes its users. Contributing flows through the contribute link, and the MIT license closes the file. For a Go developer, the practical summary is that the library behind the terminal output of the GitHub CLI is a plain import away, with the same styling conventions across the whole Charm stack.

Editorial conclusion

Use Glamour when a Go CLI application needs to render Markdown, issue bodies, README files, templates, with styled output on terminals, and when the styling should be declarative and swappable rather than hard-coded ANSI sequences. It renders pure output for a given input, so pair it with Lip Gloss when terminal capability detection matters. Before adopting, note the v2 module path at charm.land and read its upgrade guide when coming from v0, pick a style from the gallery or set GLAMOUR_STYLE for user-controlled theming, and mind the default 80-column word wrap, adjustable through WithWordWrap.

Frequently asked questions

What is the Glamour Go library?

Glamour is Charm's MIT-licensed Go library for stylesheet-based Markdown rendering on ANSI-compatible terminals. It offers dark and light default styles, custom stylesheets, configurable word wrap defaulting to 80 columns, and GLAMOUR_STYLE environment configuration, and it is used by Glow and the official GitHub, GitLab and Gitea CLIs.

how to use glamour in a Go CLI?

Import charm.land/glamour/v2 and call glamour.Render with your Markdown text and a style name such as dark, or build a renderer with glamour.NewTermRenderer and options like WithWordWrap. Set the GLAMOUR_STYLE environment variable with RenderWithEnvironmentConfig to let users choose their own style or style file.

Why are Glamour's colors wrong on my terminal?

The renderer is designed to be pure and always produce the same output for the same input, so it does not perform color downsampling by default. Pass the rendered output through Lip Gloss's Print function, which downsamples colors based on the terminal's actual capabilities.

Official sources

  1. charmbracelet/glamour on GitHub
  2. Issues
  3. License: MIT
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/charmbracelet-glamour.svg)](https://hysenlabs.com/projects/charmbracelet-glamour)