mirror of
https://git.sr.ht/~rjarry/aerc
synced 2026-03-02 18:23:33 +01:00
templates: allow layered fg & bg color for inline styles
If a user style has no fg and/or no bg color defined, use the color from the underlying style. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
This commit is contained in:
@@ -242,13 +242,15 @@ func (rb *RuneBuffer) ApplyStyle(style tcell.Style) {
|
||||
// attributes
|
||||
func (rb *RuneBuffer) ApplyAttrs(style tcell.Style) {
|
||||
for _, sr := range rb.buf {
|
||||
if sr.Style == tcell.StyleDefault {
|
||||
sr.Style = style
|
||||
continue
|
||||
}
|
||||
_, _, srAttrs := sr.Style.Decompose()
|
||||
_, _, attrs := style.Decompose()
|
||||
fg, bg, attrs := style.Decompose()
|
||||
sr.Style = sr.Style.Attributes(srAttrs | attrs)
|
||||
if fg != tcell.ColorDefault {
|
||||
sr.Style = sr.Style.Foreground(fg)
|
||||
}
|
||||
if bg != tcell.ColorDefault {
|
||||
sr.Style = sr.Style.Background(bg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user