some tweaks to ui theming for Fyne 2.3

This commit is contained in:
Drew Weymouth
2023-03-04 09:25:12 -08:00
parent b2fdca85a9
commit 37f272e702
5 changed files with 48 additions and 5 deletions
+4 -2
View File
@@ -1,10 +1,10 @@
package browsing
import (
"image/color"
"supersonic/backend"
"supersonic/ui/controller"
"supersonic/ui/layouts"
myTheme "supersonic/ui/theme"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
@@ -69,7 +69,9 @@ func NewBrowsingPane(app *backend.App) *BrowsingPane {
b.app.PlaybackManager.OnSongChange(b.onSongChange)
b.pageContainer = container.NewMax(
// TODO: get this color into the theme
canvas.NewRectangle(color.RGBA{R: 24, G: 24, B: 40, A: 255}),
canvas.NewRectangle(fyne.CurrentApp().Settings().Theme().Color(
myTheme.ColorNamePageBackground, theme.VariantDark,
)),
layout.NewSpacer())
b.settingsBtn = widget.NewButtonWithIcon("", theme.SettingsIcon(), func() {
p := widget.NewPopUpMenu(b.settingsMenu,
+40
View File
@@ -0,0 +1,40 @@
package theme
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
)
const ColorNamePageBackground fyne.ThemeColorName = "PageBackground"
type MyTheme struct{}
var _ fyne.Theme = (*MyTheme)(nil)
func (m MyTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
switch name {
case ColorNamePageBackground:
return color.RGBA{R: 20, G: 20, B: 20, A: 255}
case theme.ColorNameBackground:
return color.RGBA{R: 40, G: 40, B: 40, A: 255}
case theme.ColorNameScrollBar:
return theme.DarkTheme().Color(theme.ColorNameForeground, variant)
case theme.ColorNameButton:
return theme.DarkTheme().Color(theme.ColorNameInputBackground, variant)
}
return theme.DarkTheme().Color(name, variant)
}
func (m MyTheme) Icon(name fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(name)
}
func (m MyTheme) Font(style fyne.TextStyle) fyne.Resource {
return theme.DefaultTheme().Font(style)
}
func (m MyTheme) Size(name fyne.ThemeSizeName) float32 {
return theme.DefaultTheme().Size(name)
}
+1 -1
View File
@@ -42,7 +42,7 @@ func NewListHeader(cols []ListColumn, layout *layouts.ColumnsLayout) *ListHeader
for i, _ := range l.columnVisible {
l.columnVisible[i] = true
}
l.container = container.NewMax(canvas.NewRectangle(theme.ButtonColor()), l.columnsContainer)
l.container = container.NewMax(canvas.NewRectangle(theme.BackgroundColor()), l.columnsContainer)
l.ExtendBaseWidget(l)
l.buildColumns()
return l
+1 -1
View File
@@ -36,7 +36,7 @@ func NewNowPlayingCard() *NowPlayingCard {
n.cover.SetMinSize(fyne.NewSize(85, 85))
n.cover.FillMode = canvas.ImageFillContain
n.c = container.NewBorder(nil, nil, container.New(&layouts.CenterPadLayout{PadLeftRight: 3, PadTopBottom: 5}, n.cover), nil,
n.c = container.NewBorder(nil, nil, n.cover, nil,
container.New(&layouts.VboxCustomPadding{ExtraPad: -12}, n.trackName, n.artistName, n.albumName))
return n
}