want to achieve: Produce colored output over other colored output, with underlying uncovered output preserved.
my attempt: bellow, where model
is Bubbletea’s model interface implementation
import gloss "github.com/charmbracelet/lipgloss"
func (m model) View() string {
diagStyle := gloss.NewStyle().
Background(gloss.Color("#0000aa"))
r1Style := gloss.NewStyle().
Inherit(diagStyle).
Foreground(gloss.Color("#ffff00"))
r2Style := gloss.NewStyle().
Inherit(diagStyle).
Foreground(gloss.Color("#ff0000"))
r3Style := gloss.NewStyle().
Inherit(diagStyle).
Foreground(gloss.Color("#ffffff"))
out := diagStyle.
Width(30).
Height(5).
Padding(1, 2).
Render(
gloss.JoinVertical(gloss.Left,
r1Style.Render("Alice"),
r2Style.Render("Bob"),
r3Style.Render("Charlie"),
),
)
return out
}
produces following output with artifacts:
How to fix it, to preserve blueish background color of underlying diagStyle
? (after Alice and Bob)