Skip to content

v2.1.0

Latest

Choose a tag to compare

@lrstanley lrstanley released this 22 Nov 05:44
· 41 commits to master since this release
v2.1.0
7152e93

✨ Highlights

Follow the terminal's theme

The new opt-in sources module reads the colors from the user's terminal config, so an
app can match the terminal it's running in, and stay in sync as the user changes themes.
It supports kitty, Ghostty, Alacritty, foot, Windows Terminal, Xresources, and
.itermcolors files, and terminal.Detect picks the right one from the environment:

import (
	"github.com/lrstanley/bubbletint/sources/v2/terminal"
	tint "github.com/lrstanley/bubbletint/v2"
)

src, err := terminal.Detect() // The source for the terminal we're running in.
if err == nil {
	detach, err := tint.Attach(ctx, src)
	// [...]
}

The terminal's tint is registered as e.g. kitty:current, and becomes the current tint
(use tint.WithFollow(false) to only register it). Sources live in their own module, so
the core stays free of dependencies. See
Follow the terminal's theme,
and the follow-terminal example.

React to registry changes

Subscribe calls a function whenever a registry changes: a tint being added, updated or
removed, or the current tint changing. Listen for CurrentChanged to know when to rebuild
your styles:

cancel := tint.Subscribe(func(ev tint.Event) {
	if ev.Kind == tint.CurrentChanged {
		p.Send(rebuildStylesMsg{}) // Forward it to your Bubble Tea program.
	}
})
defer cancel()

Behavior changes

  • Unregistering the current tint now selects the next tint by sorted ID (or the previous
    one), instead of leaving the registry pointing at a tint that's gone.
  • When no tint is selected, Current() now selects the first registered tint and returns
    it. Before, it could panic, or return nil if the selected tint had been unregistered.

Changelog

✨ New Features

🐞 Bug Fixes

🧹 Misc

2 changes

📦 Dependency Updates

2 changes
  • 9120cd7: deps: update iterm-schemes from release-20261012-151317-d3e95e4 to release-20261019-151001-86a776d (#34) (@lrstanley)
  • 5d56884: deps: update iterm-schemes from release-20261019-151001-86a776d to release-20261116-150709-494b809 (#36) (@lrstanley)

Full changelog: v2.0.4...v2.1.0

📦 Install

go get github.com/lrstanley/bubbletint/chromatint/v2@v2.1.0
go get github.com/lrstanley/bubbletint/glamourtint/v2@v2.1.0
go get github.com/lrstanley/bubbletint/sources/v2@v2.1.0
go get github.com/lrstanley/bubbletint/v2@v2.1.0

Docs:

💬 What to do next?