Skip to content

v2.2.0-alpha.1

Pre-release
Pre-release

Choose a tag to compare

@lrstanley lrstanley released this 26 Nov 14:32
· 4 commits to master since this release
v2.2.0-alpha.1
3fda1c6

Highlights

Roles return Lip Gloss styles

The roles module now hands back Lip Gloss styles, so styling from a role no longer needs glue code in every app. Each style carries the attribute that stands in for a color where the terminal can't draw it, such as faint for muted text at 16 colors, or reverse for the selection with no color at all.

f := roles.Derive(tint.Current()).Fit(roles.Target{Profile: msg.Profile}) // tea.ColorProfileMsg

hint := f.Text(roles.Subtle)        // text in a role's color
pill := f.Fill(roles.Danger)        // a solid tone, with the text that reads on it
soft := f.Fill(roles.Danger.Soft()) // a faded tone, with the tone as text

// Text on a surface is kept readable there, and drawn on the surface's color.
dialog := f.Fill(roles.Raised)
note := f.On(roles.Raised).Text(roles.Muted)

f.On(surface) is worked out once per surface, so it's cheap to call while rendering.

Upgrading from v2.2.0-alpha.0

  • roles.Target{Depth: roles.DepthOf(p)} is now roles.Target{Profile: p}, taking a colorprofile.Profile directly. Depth, its constants, DepthOf and Fitted.Depth are gone.
  • Palette.Tone, Guarded, Mono, AccentSlot and Accent2Slot are removed. Use p.Color(r), p.Color(r.Soft()) and p.Color(r.On()) in place of Tone.

The complex and load-from-file examples now style from roles, which keeps their buttons readable on every tint:

complex example

Changelog

⚠️ Breaking Changes

  • b7e54cd: roles: style with Lip Gloss, and draw text on surfaces with On (@lrstanley)
    • Target.Depth, Depth, DepthOf, Fitted.Depth, Palette.Tone, Tone, Palette.Guarded, Palette.Mono, Palette.AccentSlot and Palette.Accent2Slot are removed. Use Target.Profile with a colorprofile.Profile.

📚 Documentation

🧹 Misc

1 change

Full changelog: v2.2.0-alpha.0...v2.2.0-alpha.1

📦 Install

go get github.com/lrstanley/bubbletint/chromatint/v2@v2.2.0-alpha.1
go get github.com/lrstanley/bubbletint/glamourtint/v2@v2.2.0-alpha.1
go get github.com/lrstanley/bubbletint/roles/v2@v2.2.0-alpha.1
go get github.com/lrstanley/bubbletint/sources/v2@v2.2.0-alpha.1
go get github.com/lrstanley/bubbletint/v2@v2.2.0-alpha.1

Docs:

💬 What to do next?