diff --git a/convert/image/convert.go b/convert/image/convert.go index 58f9895..729b700 100644 --- a/convert/image/convert.go +++ b/convert/image/convert.go @@ -238,7 +238,14 @@ func downgradeWithPalette(in *image.NRGBA, p color.Palette) *image.NRGBA { if cc := cache[c]; cc != nil { in.Set(x, y, cc) } else { - cPalette := p.Convert(c) + var cPalette color.Color + // check value transparency + r, g, b, a := c.RGBA() + if r == 0 && g == 0 && b == 0 && a == 0 { + cPalette = p[0] + } else { + cPalette = p.Convert(c) + } in.Set(x, y, cPalette) cache[c] = cPalette } diff --git a/ui/martine-ui/sprite_tab.go b/ui/martine-ui/sprite_tab.go index 8a9576a..b6ca7b3 100644 --- a/ui/martine-ui/sprite_tab.go +++ b/ui/martine-ui/sprite_tab.go @@ -264,7 +264,11 @@ func (m *MartineUI) newSpriteTab(s *menu.SpriteMenu) *fyne.Container { ), ), container.New( - layout.NewGridLayoutWithRows(2), + layout.NewGridLayoutWithRows(3), + container.New(layout.NewVBoxLayout(), + widget.NewCheck("Use this palette", func(b bool) { + s.UsePalette = b + })), container.New( layout.NewVBoxLayout(), widget.NewLabel("Palette"),