Fix View transparency to Gui

pull/232/head
Simon Roberts 3 years ago
parent c0d75adeb6
commit 22a7d527dc
No known key found for this signature in database
GPG Key ID: 0F30F99E6B771FD4

@ -494,6 +494,14 @@ func (g *Gui) fixColor(c tcell.Color) tcell.Color {
return c
}
func (g *Gui) MkColor(color Attribute) tcell.Color {
if color == ColorDefault {
return tcell.ColorDefault
} else {
return g.fixColor(tcell.PaletteColor(int(color)&0x1ff - 1))
}
}
// TODO: delete termbox compat
func (g *Gui) MkStyle(fg, bg Attribute) tcell.Style {
st := tcell.StyleDefault

@ -354,7 +354,15 @@ func (v *View) draw() error {
// bgColor = v.BgColor
// }
if err := v.setRune(x, y, c.chr, c.style); err != nil {
st := c.style
fgColor, bgColor, _ := c.style.Decompose()
if fgColor == tcell.ColorDefault {
st = st.Foreground(v.g.MkColor(v.FgColor))
}
if bgColor == tcell.ColorDefault {
st = st.Background(v.g.MkColor(v.BgColor))
}
if err := v.setRune(x, y, c.chr, st); err != nil {
return err
}
x++

Loading…
Cancel
Save