Skip to content

Releases

v2.1.1

Choose a tag to compare

@github-actions github-actions released this 15 Nov 06:35
v2.1.1
a79c946

Tiny patch

This version just bumps down the minimum Go version to match our other libraries

Have a nice Sunday,
Charm XX ๐ŸŒฆ๏ธ

Changelog

Fixed

Other stuff


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on X, Discord, Slack, The Fediverse, Bluesky.

v2.1.0

Choose a tag to compare

@github-actions github-actions released this 09 Nov 13:17
v2.1.0
ff16a4e

New table parameter and many fixes

Hi all! This release gives tables a new feature. They can now size themselves to their content and still respect a maximum width. It also comes with a big batch of fixes, many of them from first-time contributors. Let's go!

Fit Content on tables

Screenshot 2026-11-09 at 17 15 17

Until now, setting Width on a table meant it would always stretch to fill that width, even if it only had three short words in it. Now there's FitContent():

t := table.
	Width(72).
    FitContent().
    Headers("LANGUAGE", "FORMAL", "INFORMAL").
    Rows(rows...)

With FitContent, the table renders at the width its content actually needs. Width becomes a ceiling, if the content is wider than that, the table is held to the maximum and wraps like before.

Perfect for sidebars, popups, and anywhere a table shouldn't go far. Thanks, @pete-woods!

Darker Darks, Lighter Lights

Lip Gloss now decides whether a color is dark using CIELAB lightness instead of HSL. In simple words, it now judges dark and light the way your eyes do, so saturated blues and purples are no longer mistaken for light colors. LightDark and friends will pick the right side more often. Thanks, @janearc!

Full-Fidelity RGB

RGBColor channels are now 16 bits, so colors survive the round trip through color.Color without losing precision. Thanks, @MokiMeow!

Faster Wrapping

Wrap now sizes its buffer up front and copies bytes in runs instead of one at a time. Thanks, @taciturnaxolotl!

That's all for now,
Charm XX ๐Ÿ’ซ

Changelog

New!

Fixed

Other stuff


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on X, Discord, Slack, The Fediverse, Bluesky.

v2.0.6

Choose a tag to compare

@github-actions github-actions released this 11 Aug 17:18
v2.0.6
733ce53

Devanagari, auto-grapheme mode, and more

Hi! The big news in this release is that Lip Gloss now properly renders Devanagari (Hindi)! Beyond thatโ€”or perhaps as a resultโ€”Lip Gloss will now switch to mode 2027 for grapheme support when possible.

There's other good stuff too. Let's go!

เค•เฅเคฏเคพ เคนเคพเคฒ เคนเฅˆ?

Hindi speakers, it's about time! Lip Gloss and Ultraviolet now properly renders Devanagari. That means Bubble Tea will as well.

Screenshot 2026-08-12 at 10 12 14

This brings us toโ€ฆ

Cyberpunk 2027

Lip Gloss (and Ultraviolet) now asks the terminal at startup whether it supports Unicode core mode (DEC mode 2027), and when it does, measures widths the same way the terminal does. We did this for Devanagari but it also means Emojis and things render better now too. Let's go!

Shrinky tables: not anymore

Columns no longer shrink to zero width. Thanks, @taciturnaxolotl!


Changelog

Fixed


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on X, Discord, Slack, The Fediverse, Bluesky.

v2.0.5

Choose a tag to compare

@github-actions github-actions released this 03 Jul 02:07
v2.0.5
5bd778d

Graphemes, Schmraphemes

If youโ€™re using emojis in the terminal you're in for a rough ride. That said, we do what we can. This release brings some in some very specific edge case rendering improvements. Enjoy.

Enjoy!

Changelog

  • 10f9584: chore(deps): bump ultraviolet for emoji-related improvements

The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on X, Discord, Slack, The Fediverse, Bluesky.

v2.0.4

Choose a tag to compare

@taciturnaxolotl taciturnaxolotl released this 12 Jun 13:50

Mini Crash Patch

Hi! This is a small patch to fix a writer-related panic. Thanks for using Lip Gloss!

Changelog

Fixed

Docs

Chore


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on X, Discord, Slack, The Fediverse, Bluesky.

v2.0.3

Choose a tag to compare

@github-actions github-actions released this 13 Apr 17:16
v2.0.3
472d718

Changelog

Fixed

Docs


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on X, Discord, Slack, The Fediverse, Bluesky.

v2.0.2

Choose a tag to compare

@github-actions github-actions released this 11 Mar 13:38
v2.0.2
9856c04

Table patch

If you don't know, we made big improvements in table rendering recently shipped in v2.0.0.

@MartinodF made a good job on improving it even further for tricky edge cases, in particular when content wrapping is enabled.

Changelog

Fixed


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on X, Discord, Slack, The Fediverse, Bluesky.

v2.0.1

Choose a tag to compare

@github-actions github-actions released this 09 Mar 10:59
v2.0.1
bffdafb

A small release to properly set style underline colors, as well as handling partial reads while querying the terminal.

Changelog

Fixed

Docs

Other stuff

  • 92b13d8: ci: sync golangci-lint config (#621) (@github-actions[bot])

The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on X, Discord, Slack, The Fediverse, Bluesky.

v2.0.0

Choose a tag to compare

@github-actions github-actions released this 24 Feb 15:33
v2.0.0
8863cc0

lipgloss-v2-block

Do you think you can handle Lip Gloss v2?

Weโ€™re really excited for you to try Lip Gloss v2! Read on for new features and a guide to upgrading.

If you (or your LLM) just want the technical details, take a look at Upgrade Guide.

Note

We take API changes seriously and strive to make the upgrade process as simple as possible. We believe the changes bring necessary improvements as well as pave the way for the future. If something feels way off, let us know.

Whatโ€™s new?

The big changes are that Styles are now deterministic (ฮปipgloss!) and you can be much more intentional with your inputs and outputs. Why does this matter?

Playing nicely with others

v2 gives you precise control over I/O. One of the issues we saw with the Lip Gloss and Bubble Tea v1s is that they could fight over the same inputs and outputs, producing lock-ups. The v2s now operate in lockstep.

Querying the right inputs and outputs

In v1, Lip Gloss defaulted to looking at stdin and stdout when downsampling colors and querying for the background color. This was not always necessarily what you wanted. For example, if your application was writing to stderr while redirecting stdout to a file, the program would erroneously think output was not a TTY and strip colors. Lip Gloss v2 gives you control over this.

Going beyond localhost

Did you know TUIs and CLIs can be served over the network? For example, Wish allows you to serve Bubble Tea and Lip Gloss over SSH. In these cases, you need to work with the input and output of the connected clients as opposed to stdin and stdout, which belong to the server. Lip Gloss v2 gives you flexibility around this in a more natural way.

๐Ÿง‹ Using Lip Gloss with Bubble Tea?

Make sure you get all the latest v2s as theyโ€™ve been designed to work together.

# Collect the whole set.
go get charm.land/bubbletea/v2
go get charm.land/bubbles/v2
go get charm.land/lipgloss/v2

๐Ÿ‡ Quick upgrade

If you don't have time for changes and just want to upgrade to Lip Gloss v2 as fast as possible? Hereโ€™s a quick guide:

Use the compat package

The compat package provides adaptive colors, complete colors, and complete adaptive colors:

import "charm.land/lipgloss/v2/compat"

// Before
color := lipgloss.AdaptiveColor{Light: "#f1f1f1", Dark: "#cccccc"}

// After
color := compat.AdaptiveColor{Light: lipgloss.Color("#f1f1f1"), Dark: lipgloss.Color("#cccccc")}

compat works by looking at stdin and stdout on a global basis. Want to change the inputs and outputs? Knock yourself out:

import (
	"charm.land/lipgloss/v2/compat"
	"github.com/charmbracelet/colorprofile"
)

func init() {
	// Letโ€™s use stderr instead of stdout.
	compat.HasDarkBackground = lipgloss.HasDarkBackground(os.Stdin, os.Stderr)
	compat.Profile = colorprofile.Detect(os.Stderr, os.Environ())
}

Use the new Lip Gloss writer

If youโ€™re using Bubble Tea with Lip Gloss you can skip this step. If you're using Lip Gloss in a standalone fashion, however, you'll want to use lipgloss.Println (and lipgloss.Printf and so on) when printing your output:

s := someStyle.Render("Fancy Lip Gloss Output")

// Before
fmt.Println(s)

// After
lipgloss.Println(s)

Why? Because lipgloss.Println will automatically downsample colors based on the environment.

Thatโ€™s it!

Yep, youโ€™re done. All this said, we encourage you to read on to get the full benefit of v2.

๐Ÿ‘€ Whatโ€™s changing?

Only a couple main things that are changing in Lip Gloss v2:

  • Color downsampling in non-Bubble-Tea uses cases is now a manual proccess (don't worry, it's easy)
  • Background color detection and adaptive colors are manual, and intentional (but optional)

๐Ÿช„ Downsampling colors with a writer

One of the best things about Lip Gloss is that it can automatically downsample colors to the best available profile, stripping colors (and ANSI) entirely when output is not a TTY.

If you're using Lip Gloss with Bubble Tea there's nothing to do here: downsampling is built into Bubble Tea v2. If you're not using Bubble Tea you now need to use a writer to downsample colors. Lip Gloss writers are a drop-in replacement for the usual functions found in the fmt package:

s := someStyle.Render("Hello!")

// Downsample and print to stdout.
lipgloss.Println(s)

// Render to a variable.
downsampled := lipgloss.Sprint(s)

// Print to stderr.
lipgloss.Fprint(os.Stderr, s)

๐ŸŒ› Background color detection and adaptive colors

Rendering different colors depending on whether the terminal has a light or dark background is an awesome power. Lip Gloss v2 gives you more control over this progress. This especially matters when input and output are not stdin and stdout.

If that doesnโ€™t matter to you and you're only working with stdout you skip this via compat above, though we encourage you to explore this new functionality.

With Bubble Tea

In Bubble Tea, request the background color, listen for a BackgroundColorMsg in your update, and respond accordingly.

// Query for the background color.
func (m model) Init() tea.Cmd {
	return tea.RequestBackgroundColor
}

// Listen for the response and initialize your styles accordigly.
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
	switch msg := msg.(type) {
	case tea.BackgroundColorMsg:
		// Initialize your styles now that you know the background color.
		m.styles = newStyles(msg.IsDark())
		return m, nil
	}
}

type styles {
    myHotStyle lipgloss.Style
}

func newStyles(bgIsDark bool) (s styles) {
	lightDark := lipgloss.LightDark(bgIsDark) // just a helper function
	return styles{
		myHotStyle := lipgloss.NewStyle().Foreground(lightDark("#f1f1f1", "#333333"))
	}
}

Standalone

If you're not using Bubble Tea you simply can perform the query manually:

// Detect the background color. Notice we're writing to stderr.
hasDarkBG, err := lipgloss.HasDarkBackground(os.Stdin, os.Stderr)
if err != nil {
    log.Fatal("Oof:", err)
}

// Create a helper for choosing the appropriate color.
lightDark := lipgloss.LightDark(hasDarkBG)

// Declare some colors.
thisColor := lightDark("#C5ADF9", "#864EFF")
thatColor := lightDark("#37CD96", "#22C78A")

// Render some styles.
a := lipgloss.NewStyle().Foreground(thisColor).Render("this")
b := lipgloss.NewStyle().Foreground(thatColor).Render("that")

// Print to stderr.
lipgloss.Fprintf(os.Stderr, "my fave colors are %s and %s...for now.", a, b)

๐Ÿฅ• Other stuff

Colors are now color.Color

lipgloss.Color() now produces an idiomatic color.Color, whereas before colors were type lipgloss.TerminalColor. Generally speaking, this is more of an implementation detail, but itโ€™s worth noting the structural differences.

// Before
type TerminalColor interface{/* ... */}
type Color string

// After
func Color(string) color.Color
type RGBColor struct{R, G, B uint8}

func LightDark(isDark bool) LightDarkFunc
type LightDarkFunc func(light, dark color.Color) color.Color
func Complete(colorprofile.Profile) CompleteFunc
type CompleteFunc func(ansi, ansi256, truecolor color.Color) color.Color

Changelog

New!

Fixed

Read more

v2.0.0-beta.3

v2.0.0-beta.3 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 10 Jul 18:49
v2.0.0-beta.3
a391435

Padding, Schmadding

This new beta release reverts back to a major change when it comes to using regular spacing for padding. We found that using NBSP \u00a0 causes more problems than it solves. Things like simply copying the output from the terminal and then paste it back wouldn't work if NBSPs exist in a command.

To solve this, we've added style.PaddingChar(rune) and style.MarginChar(rune) to customize the characters used in padding and margins respectively.

Changelog

New Features

Bug fixes


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.