x
x copied to clipboard
refactor(colors): update to lipgloss alpha
TODO
- [ ] update the lipgloss branch to the latest
v2-exp
Example Usage:
Divides into Light and Dark colour palettes. In your app, you can switch which colour palette depending on the TerminalBackgroundMsg
func NewStyle(isDark bool) Styles {
color := colors.Light
if isDark {
color = colors.Dark
}
return Styles{
Normal: lipgloss.NewStyle().Foreground(color.Normal),
NormalDim: lipgloss.NewStyle().Foreground(color.NormalDim),
Keyword: lipgloss.NewStyle().Foreground(color.Green),
KeywordDim: lipgloss.NewStyle().Foreground(color.GreenDim),
Item: lipgloss.NewStyle().PaddingLeft(3),
DeletingItem: lipgloss.NewStyle().Foreground(color.Red),
SelectedItem: lipgloss.NewStyle().Foreground(lipgloss.Color("170")),
Accent: lipgloss.NewStyle().Foreground(color.Fuschia),
}}
In your model’s Update:
case tea.BackgroundColorMsg:
isDark := lipgloss.IsDarkColor(msg)
// Update styles
m.Styles = NewStyle(isDark)
m.setBubbleStyles() // sets the styles for all of the submodels/bubbles used by this model