Skip to content

v2.2.0-alpha.6

Pre-release
Pre-release

Choose a tag to compare

@lrstanley lrstanley released this 29 Nov 04:18
· 3 commits to master since this release
v2.2.0-alpha.6
0938dd6

Highlights

  • roles: Fitted.Scan fills a struct of your own from role struct tags. A package that can't import roles can declare its palette, and get roles' derivation, contrast guards and fitting for every ground without importing it. Each swatch holds what Text or Fill would draw: a Color and the Attr bits that stand in for it.

    type Swatch struct {
    	Color color.Color
    	Attr  uint8
    }
    
    type Palette struct {
    	Muted    Swatch `role:"muted"`
    	Hover    Swatch `role:"ground:hover"`
    	OnDanger Swatch `role:"fg@danger"` // body text on a danger fill
    	Dialog   struct {
    		Muted Swatch `role:"muted"`
    	} `role:"@raised"` // drawn on a dialog
    }
    
    var p Palette
    err := roles.Derive(t).Fit(target).Scan(&p)

    Unknown roles and states are errors, so a typo doesn't leave a color unset.

Changelog

✨ New Features

Full changelog: v2.2.0-alpha.5...v2.2.0-alpha.6

📦 Install

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

Docs:

💬 What to do next?