make pop up play queue slightly translucent
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/color"
|
||||
"io"
|
||||
"log"
|
||||
"net/url"
|
||||
@@ -18,6 +19,7 @@ import (
|
||||
"github.com/dweymouth/supersonic/backend/player/mpv"
|
||||
"github.com/dweymouth/supersonic/sharedutil"
|
||||
"github.com/dweymouth/supersonic/ui/dialogs"
|
||||
myTheme "github.com/dweymouth/supersonic/ui/theme"
|
||||
"github.com/dweymouth/supersonic/ui/util"
|
||||
"github.com/dweymouth/supersonic/ui/widgets"
|
||||
|
||||
@@ -121,10 +123,18 @@ func (m *Controller) ShowPopUpPlayQueue() {
|
||||
title := widget.NewRichTextWithText(lang.L("Play Queue"))
|
||||
title.Segments[0].(*widget.TextSegment).Style.Alignment = fyne.TextAlignCenter
|
||||
title.Segments[0].(*widget.TextSegment).Style.TextStyle.Bold = true
|
||||
container := container.NewBorder(title, nil, nil, nil,
|
||||
ctr := container.NewBorder(title, nil, nil, nil,
|
||||
container.NewPadded(m.popUpQueue),
|
||||
)
|
||||
pop := widget.NewPopUp(container, m.MainWindow.Canvas())
|
||||
pop := widget.NewPopUp(ctr, m.MainWindow.Canvas())
|
||||
container.NewThemeOverride(pop, myTheme.WithColorTransformOverride(
|
||||
theme.ColorNameOverlayBackground,
|
||||
func(c color.Color) color.Color {
|
||||
c_ := c.(color.NRGBA)
|
||||
c_.A = 245
|
||||
return c_
|
||||
},
|
||||
))
|
||||
m.ClosePopUpOnEscape(pop)
|
||||
minSize := fyne.NewSize(300, 400)
|
||||
maxSize := fyne.NewSize(800, 1000)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package theme
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
)
|
||||
|
||||
type colorOverrideTheme struct {
|
||||
colorTransformName fyne.ThemeColorName
|
||||
colorTransform func(color.Color) color.Color
|
||||
}
|
||||
|
||||
func WithColorTransformOverride(name fyne.ThemeColorName, transform func(color.Color) color.Color) fyne.Theme {
|
||||
return &colorOverrideTheme{
|
||||
colorTransformName: name,
|
||||
colorTransform: transform,
|
||||
}
|
||||
}
|
||||
|
||||
var _ fyne.Theme = (*colorOverrideTheme)(nil)
|
||||
|
||||
func (c *colorOverrideTheme) Color(n fyne.ThemeColorName, v fyne.ThemeVariant) color.Color {
|
||||
col := fyne.CurrentApp().Settings().Theme().Color(n, v)
|
||||
if n == c.colorTransformName {
|
||||
return c.colorTransform(col)
|
||||
}
|
||||
return col
|
||||
}
|
||||
|
||||
func (*colorOverrideTheme) Font(s fyne.TextStyle) fyne.Resource {
|
||||
return fyne.CurrentApp().Settings().Theme().Font(s)
|
||||
}
|
||||
|
||||
func (*colorOverrideTheme) Icon(s fyne.ThemeIconName) fyne.Resource {
|
||||
return fyne.CurrentApp().Settings().Theme().Icon(s)
|
||||
}
|
||||
|
||||
func (*colorOverrideTheme) Size(s fyne.ThemeSizeName) float32 {
|
||||
return fyne.CurrentApp().Settings().Theme().Size(s)
|
||||
}
|
||||
Reference in New Issue
Block a user