Skip to content

fix(deps): update module github.com/charmbracelet/lipgloss to v2 #1732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate-bot
Copy link
Collaborator

@renovate-bot renovate-bot commented Mar 23, 2025

This PR contains the following updates:

Package Change Age Confidence
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 -> v2.0.0-beta.3 age confidence

Release Notes

charmbracelet/lipgloss (github.com/charmbracelet/lipgloss)

v2.0.0-beta.3

Compare Source

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.

v2.0.0-beta.2

Compare Source

So Hot Right Now: Lip Gloss v2 Beta 2

This release builds on top of the last beta 1 release. It includes a new API for compositing layers and views, table enhancements, and a bunch of bug fixes. Let's get into it!

Compositing

layers

The big news in this release is compositing. Here's what it looks like:

box := lipgloss.NewStyle().
    Width(10).
    Height(5).
    Border(lipgloss.NormalBorder())

// Make some layers.
a := lipgloss.NewLayer(box.Render("Who wants marmalade?"))
b := lipgloss.NewLayer(box.Render("I do!"))

// Put layers in a canvas.
canvas := lipgloss.NewCanvas(
    a.X(5).Y(10).Z(1),
    b.X(3).Y(7)
)

// Render it all out.
lipgloss.Println(canvas.Render())

Also note that layers can also be nested (see Layer.AddLayers).
Otherwise, that’s all there is to it!

For more info see Layer, Canvas, and the compositing example.

Table Enhancements

Tables are one of the most beloved Charm components, and we've been working to
make them as polished as possible. In this release several bugs were fixed,
and many other rendering enhancements were made. You can check most of the fixes
on #​526.

We're also refactoring the Bubbles' table component to use the Lip Gloss' table package, and making their APIs similar, as before they were relatively different. This means that if you use Tables via Bubbles in your Bubble Tea app, you'll be able to reap the benefits soon too!

Changelog

New Features
  • ad4ad6de5ac5449ecee7a04a37ad7f987d86f834: feat(examples): add clickable example (@​aymanbagabas)
  • c20d40442fae4e30f0dc2bf747fc726d11ab945f: feat(examples): clickable: make it "pure" (@​aymanbagabas)
  • 2790cd0292d3afd96abd251d3af9f5f0bbe7b8f3: feat(table): add BaseStyle to set background color for the whole table (#​519) (@​andreynering)
  • e2227d9b55d12629e7901e5b40e0378370af2892: feat(table): add some extra getters needed on bubbles (@​andreynering)
  • 488eb3757443d79d0cb292af499a449d52372361: feat(table): expose getters for borders (@​andreynering)
  • 587de15a4f99ade6d20bd6692019a25ac9f58e89: feat(table): further enhance and fix table height handling (@​andreynering)
  • 4b89e653aaead4e9758bc7aebfcbe6b5814c400f: feat(table): rework height rendering logic to fix related bugs (@​andreynering)
  • 600244163f543404bae832fa4f340fc1129dba5d: feat: export GetHeaders, GetData and DataToMatrix (@​andreynering)
  • 75c05692f770a4e0c8f876f21547324a5bb6aa18: feat: initial compositing implementation (@​aymanbagabas)
  • 2c4751e06ce44cbf9e24dfe61957fe99250aac67: feat: initial compositing implementation (#​471) (@​meowgorithm)
Bug fixes
  • 9ae54a0eebb71fcb2443369fedc8344c6da9eda8: fix(border): fix returned border sizes when only style was set (@​andreynering)
  • c80afba684548e86959fbae0e05f7727aa626d32: fix(canvas): negative coordinates calculation (@​aymanbagabas)
  • c201d5952318d568e731c24f01e16947f1f152b3: fix(lint): GoDoc (@​meowgorithm)
  • f274d052315e6e95222d806d7602952cc4d08c87: fix(lint): fix linting issues after golangci-lint v2 upgrade (@​andreynering)
  • 1427d827c8acabec13feb58530dc2fca53563155: fix(table): add tests + fix scenario of offset + manual table height (@​andreynering)
  • c0f4b07e2c9ad4b1c0c27b9a61555a2e6180e0eb: fix(table): do not print final empty row when overflow (@​andreynering)
  • bc517ae87e99ab44ad85f3f59ac8b6ca9f6285c4: fix(table): fix headers with custom vertical padding (@​andreynering)
  • baa7611731e620ee4115e94ea1ba9e29f21cc44b: fix(table): fix horizontal shrink with outline borders only (@​andreynering)
  • 63e53c126330858b5d59aba9547dbe1be99b1b84: fix(table): fix layout for tables with inner borders only (@​andreynering)
  • c6b946e574dddb956f8642c9f84fa0219b777ed3: fix(table): fix panic when style func is nil (#​508) (@​andreynering)
  • a3d464b6b28e00dd87a5cedce33576f86c0911c7: fix(table): fix rendering for bordered cells (@​andreynering)
  • b36834acd7c6412885a4e8b32791898ffd1abfe3: fix(table): improve height handling for cells with vertical padding (@​andreynering)
Documentation updates
  • e9f399ea6d86f3e0b2e540211d4c1e16ccd773ba: docs(example): add compositing example (#​544) (@​meowgorithm)
  • fabe5147c91164b0b12945097c2429adcf79fb16: docs(examples): add compositing to layout example (@​meowgorithm)
  • 4781de297de3f6a2beb663c919b39246e24b1436: docs(examples): update Bubble Tea examples to use new API (@​aymanbagabas)
  • 946081c6f1a5b6bd4e368c60f49935be71279af2: docs(table): document that headers are never wrapped (@​andreynering)
Other work
  • 7edbc41e909ef23d0c3b9e88e157966e1c0d814c: ci: fix linting (@​andreynering)
  • c7f615e1a3bf6cdfa0cf365dacc9a9193a7247c0: ci: fix new lint issues after golangci-lint v2 upgrade (#​510) (@​andreynering)
  • d102bea711a2576bba7d80e0639fffba8be23b80: ci: sync golangci-lint config (#​509) (@​github-actions[bot])
  • 40640fe3494c7b4050fdccd9abb8e2705d6ecab6: refactor: modernize loops (@​andreynering)
  • 23e0f7f3dae03637de68504142aeff17ca73bd65: refactor: v2 rename offset (#​512) (@​bashbunni)

How’s it going?

Feel free to reach out, ask questions, give feedback, and let us know how it's going. We’d love to know what you think.


Part of Charm.

The Charm logo

Charm热爱开源 • Charm loves open source • نحنُ نحب المصادر المفتوحة

v2.0.0-beta.1

Compare Source

Who said a beta release can’t be exciting?

We're thrilled to announce the first beta release of Lip Gloss v2! This release builds on top of the last alpha 2 release. Very little has changed since the last alpha, which means we’re getting closer to a proper v2.0.0.

The only change here is that you can no longer use hexadecimal and integer format when defining colors. We found there were just to many gotchas and this way the API remains backwards compatible.

// Before in alpha 2
// This is a bug! It's not intuitive to use integers here.
// Should this be a hex color or ANSI(204)?
a := lipgloss.Color(0x0000cc) // 0xcc is 204, which was interpreted as an ANSI color, not #​0000cc

// After
a := lipgloss.Color("#​0000cc") // This is a hex color
b := lipgloss.Color("204")     // This is an ANSI color
c := lipgloss.ANSIColor(204)   // Equivalent to b

🌈 More on Lip Gloss v2

Just getting into Lip Gloss v2? Check out the full v2 release notes and upgrade guide.

💝 How’s it going?

Feel free to reach out, ask questions, give feedback, and let us know how it's going. We’d love to know what you think.


Part of Charm.

The Charm logo

Charm热爱开源 • Charm loves open source • نحنُ نحب المصادر المفتوحة

v2.0.0-alpha.2

Compare Source

Do you think you can handle Lip Gloss v2?

We’re really excited for you to try Lip Gloss v2! Keep in mind that this is an early alpha release and things may change.

[!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.

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 and intentionality 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.

go get github.com/charmbracelet/bubbletea/v2@​v2.0.0-alpha.2
go get github.com/charmbracelet/bubbles/v2@​v2.0.0-alpha.2
go get github.com/charmbracelet/lipgloss/v2@​v2.0.0-alpha.2

🐇 Quick upgrade

If you don't have time for changes and just want to upgrade to Lip Gloss v2 as fast as possible, do the following:

Use the compat package

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

import "github.com/charmbracelet/lipgloss/v2/compat"

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

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

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

import (
	"github.com/charmbracelet/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, 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)
That’s it!

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 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.Model, tea.Cmd) {
	return m, 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 idomatic 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(any) color.Color
type ANSIColor uint
type RGBColor struct { R, G, B uint8 }
Quotes are now optional in colors

There are also some quality-of-life niceties around color UX:

a := lipgloss.Color("#f1f1f1") // This still works
b := lipgloss.Color(0xf1f1f1)  // But this also works

c := lipgloss.Color("212") // You can still do this
d := lipgloss.Color(212)   // But you can also do this too

Changelog

Full Changelog: charmbracelet/lipgloss@v1.0.0...v2.0.0-alpha.2

🌈 Feedback

That's a wrap! Feel free to reach out, ask questions, and let us know how it's going. We'd love to know what you think.


Part of Charm.

The Charm logo

Charm热爱开源 • Charm loves open source • نحنُ نحب المصادر المفتوحة


Configuration

📅 Schedule: Branch creation - "before 6am on monday" in timezone Australia/Sydney, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@forking-renovate forking-renovate bot added the dependencies Pull requests that update a dependency file label Mar 23, 2025
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch 5 times, most recently from b8e484a to ce07963 Compare March 31, 2025 16:57
@renovate-bot renovate-bot changed the title fix(deps): update module github.com/owenrumney/go-sarif/v2 to v3 fix(deps): update osv-scanner minor to v3 (major) Mar 31, 2025
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch from ce07963 to 0b0aeeb Compare April 1, 2025 19:50
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch from 0b0aeeb to ad6ce44 Compare April 10, 2025 19:12
@G-Rath G-Rath self-assigned this Apr 10, 2025
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch 2 times, most recently from b0b1564 to c83006a Compare April 20, 2025 06:09
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch from c83006a to 1610f93 Compare April 24, 2025 01:07
@renovate-bot renovate-bot changed the title fix(deps): update osv-scanner minor to v3 (major) fix(deps): update osv-scanner minor (major) Apr 24, 2025
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch from 1610f93 to ed8c599 Compare April 24, 2025 08:31
@codecov-commenter
Copy link

codecov-commenter commented Apr 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.59%. Comparing base (8683682) to head (eba9428).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1732   +/-   ##
=======================================
  Coverage   67.59%   67.59%           
=======================================
  Files         172      172           
  Lines       16326    16326           
=======================================
  Hits        11035    11035           
  Misses       4613     4613           
  Partials      678      678           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch 3 times, most recently from 36ad311 to 720f77a Compare April 28, 2025 14:58
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch 2 times, most recently from 4476e17 to eca0440 Compare May 11, 2025 02:28
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch 7 times, most recently from dd850e8 to f6985ac Compare May 30, 2025 02:57
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch from f6985ac to 0b79c38 Compare June 2, 2025 03:22
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch 8 times, most recently from 25d51ec to 0018e27 Compare July 14, 2025 01:02
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch 9 times, most recently from 3eaed0c to b37cbef Compare July 21, 2025 00:26
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch 9 times, most recently from 37f10f7 to b6948d1 Compare July 25, 2025 04:48
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch 2 times, most recently from 4936107 to eba9428 Compare July 28, 2025 16:35
@renovate-bot renovate-bot force-pushed the renovate/major-osv-scanner-minor branch from eba9428 to 9fe35db Compare July 29, 2025 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants