Repository navigation
v2.2.0-alpha.0
Pre-releaseHighlights
This alpha adds semantic color roles, plus the color math they're built on. The role names and API should hold, but the derived colors may still be tuned.
Semantic roles
The new roles module works out what each color is for, such as surfaces, muted text, borders, accents and status, from any tint. You style by role instead of picking raw ANSI colors. Text stays readable on dark, light and single-hue tints, and roles fit the terminal's depth: true color, 256 colors, 16 colors, or none.
f := roles.Derive(tint.Current()).Fit(roles.Target{Depth: roles.Colors256})
title := lipgloss.NewStyle().Foreground(f.Color(roles.Accent))
hint := lipgloss.NewStyle().Foreground(f.Color(roles.Subtle))
dialog := lipgloss.NewStyle().Background(f.Color(roles.Raised))
row := f.On(roles.Selection) // text roles, re-checked for the selected rowApps can add their own roles with roles.Define, and they're derived and fitted alongside the built-in ones. See the roles example.
Color helpers
The root package now has perceptual color helpers: OKLab and OKLCh, Mix, WCAG Contrast and Luminance, IsDark, EnsureContrast and MixReadable. It also has Slot, for the terminal's 16 ANSI colors. It still has no dependencies.
fg := t.BrightBlack.EnsureContrast(*t.Bg, 4.5) // same hue, readable on the backgroundChangelog
✨ New Features
- 043124d: add perceptual color helpers, terminal slots, and a roles module (@lrstanley)
🧹 Misc
2 changes
- 3634940: add setup task for local go.work (@lrstanley)
- 59a58c5: ci: remove renovate workflow (@lrstanley)
Full changelog: v2.1.0...v2.2.0-alpha.0
📦 Install
go get github.com/lrstanley/bubbletint/chromatint/v2@v2.2.0-alpha.0
go get github.com/lrstanley/bubbletint/glamourtint/v2@v2.2.0-alpha.0
go get github.com/lrstanley/bubbletint/roles/v2@v2.2.0-alpha.0
go get github.com/lrstanley/bubbletint/sources/v2@v2.2.0-alpha.0
go get github.com/lrstanley/bubbletint/v2@v2.2.0-alpha.0Docs:
- github.com/lrstanley/bubbletint/chromatint/v2
- github.com/lrstanley/bubbletint/glamourtint/v2
- github.com/lrstanley/bubbletint/roles/v2
- github.com/lrstanley/bubbletint/sources/v2
- github.com/lrstanley/bubbletint/v2
💬 What to do next?
- 🙋♂️ Running into an issue or want a specific feature? Take a look here!
- ⌚ Find previous releases.
- 🔗 Other useful links: