Merge pull request #154 from dweymouth/feature/lighttheme

Add light theme
This commit is contained in:
Drew Weymouth
2023-05-03 17:49:42 -07:00
committed by GitHub
17 changed files with 236 additions and 56 deletions
+2 -2
View File
@@ -4,10 +4,10 @@ import (
"fmt"
"log"
"supersonic/backend"
"supersonic/res"
"supersonic/sharedutil"
"supersonic/ui/controller"
"supersonic/ui/layouts"
myTheme "supersonic/ui/theme"
"supersonic/ui/util"
"supersonic/ui/widgets"
@@ -170,7 +170,7 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
playButton := widget.NewButtonWithIcon("Play", theme.MediaPlayIcon(), func() {
go page.pm.PlayAlbum(page.albumID, 0, false)
})
shuffleBtn := widget.NewButtonWithIcon(" Shuffle", res.ResShuffleInvertSvg, func() {
shuffleBtn := widget.NewButtonWithIcon(" Shuffle", myTheme.ShuffleIcon, func() {
page.pm.LoadTracks(page.tracklist.Tracks, false, true)
page.pm.PlayFromBeginning()
})
+2 -1
View File
@@ -9,6 +9,7 @@ import (
"supersonic/sharedutil"
"supersonic/ui/controller"
"supersonic/ui/layouts"
myTheme "supersonic/ui/theme"
"supersonic/ui/util"
"supersonic/ui/widgets"
@@ -266,7 +267,7 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader {
}
a.favoriteBtn = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
a.playBtn = widget.NewButtonWithIcon("Play Discography", theme.MediaPlayIcon(), page.playAllTracks)
a.playRadioBtn = widget.NewButtonWithIcon("Play Artist Radio", res.ResShuffleInvertSvg, page.playArtistRadio)
a.playRadioBtn = widget.NewButtonWithIcon(" Play Artist Radio", myTheme.ShuffleIcon, page.playArtistRadio)
a.biographyDisp.Wrapping = fyne.TextWrapWord
a.ExtendBaseWidget(a)
a.createContainer()
+4 -8
View File
@@ -7,7 +7,6 @@ import (
myTheme "supersonic/ui/theme"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/theme"
@@ -67,11 +66,8 @@ func NewBrowsingPane(app *backend.App) *BrowsingPane {
b.forward = widget.NewButtonWithIcon("", theme.NavigateNextIcon(), b.GoForward)
b.reload = widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), b.Reload)
b.app.PlaybackManager.OnSongChange(b.onSongChange)
b.pageContainer = container.NewMax(
canvas.NewRectangle(fyne.CurrentApp().Settings().Theme().Color(
myTheme.ColorNamePageBackground, theme.VariantDark,
)),
layout.NewSpacer())
bkgrnd := myTheme.NewThemedRectangle(myTheme.ColorNamePageBackground)
b.pageContainer = container.NewMax(bkgrnd, layout.NewSpacer())
b.settingsBtn = widget.NewButtonWithIcon("", theme.SettingsIcon(), func() {
p := widget.NewPopUpMenu(b.settingsMenu,
fyne.CurrentApp().Driver().CanvasForObject(b.settingsBtn))
@@ -110,8 +106,8 @@ func (b *BrowsingPane) AddSettingsMenuItem(label string, action func()) {
fyne.NewMenuItem(label, action))
}
func (b *BrowsingPane) AddNavigationButton(iconRes fyne.Resource, action func()) {
b.navBtnsContainer.Add(widget.NewButtonWithIcon("", iconRes, action))
func (b *BrowsingPane) AddNavigationButton(icon fyne.Resource, action func()) {
b.navBtnsContainer.Add(widget.NewButtonWithIcon("", icon, action))
}
func (b *BrowsingPane) DisableNavigationButtons() {
+4 -4
View File
@@ -3,9 +3,9 @@ package browsing
import (
"log"
"supersonic/backend"
"supersonic/res"
"supersonic/ui/controller"
"supersonic/ui/layouts"
myTheme "supersonic/ui/theme"
"supersonic/ui/util"
"supersonic/ui/widgets"
"time"
@@ -73,9 +73,9 @@ func (a *FavoritesPage) createHeader(activeBtnIdx int, searchText string) {
SizeName: theme.SizeNameHeadingText,
}
a.toggleBtns = widgets.NewToggleButtonGroup(activeBtnIdx,
widget.NewButtonWithIcon("", res.ResDiscInvertPng, a.onShowFavoriteAlbums),
widget.NewButtonWithIcon("", res.ResPeopleInvertPng, a.onShowFavoriteArtists),
widget.NewButtonWithIcon("", res.ResMusicnotesInvertPng, a.onShowFavoriteSongs))
widget.NewButtonWithIcon("", myTheme.AlbumIcon, a.onShowFavoriteAlbums),
widget.NewButtonWithIcon("", myTheme.ArtistIcon, a.onShowFavoriteArtists),
widget.NewButtonWithIcon("", myTheme.TracksIcon, a.onShowFavoriteSongs))
a.searcher = widgets.NewSearcher()
a.searcher.OnSearched = a.OnSearched
a.searcher.Entry.Text = searchText
+3 -3
View File
@@ -2,8 +2,8 @@ package browsing
import (
"supersonic/backend"
"supersonic/res"
"supersonic/ui/controller"
myTheme "supersonic/ui/theme"
"supersonic/ui/util"
"supersonic/ui/widgets"
@@ -50,7 +50,7 @@ func NewGenrePage(genre string, contr *controller.Controller, pm *backend.Playba
g.titleDisp.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
SizeName: theme.SizeNameHeadingText,
}
g.playRandom = widget.NewButtonWithIcon("Play random", res.ResShuffleInvertSvg, g.playRandomSongs)
g.playRandom = widget.NewButtonWithIcon(" Play random", myTheme.ShuffleIcon, g.playRandomSongs)
iter := g.lm.GenreIter(g.genre)
g.grid = widgets.NewGridView(widgets.NewGridViewAlbumIterator(iter), g.im)
g.contr.ConnectAlbumGridActions(g.grid)
@@ -91,7 +91,7 @@ func restoreGenrePage(saved *savedGenrePage) *GenrePage {
g.titleDisp.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
SizeName: theme.SizeNameHeadingText,
}
g.playRandom = widget.NewButtonWithIcon("Play random", res.ResShuffleInvertSvg, g.playRandomSongs)
g.playRandom = widget.NewButtonWithIcon(" Play random", myTheme.ShuffleIcon, g.playRandomSongs)
g.grid = widgets.NewGridViewFromState(saved.gridState)
g.searcher = widgets.NewSearcher()
g.searcher.OnSearched = g.OnSearched
+2 -1
View File
@@ -8,6 +8,7 @@ import (
"supersonic/sharedutil"
"supersonic/ui/controller"
"supersonic/ui/layouts"
myTheme "supersonic/ui/theme"
"supersonic/ui/util"
"supersonic/ui/widgets"
@@ -205,7 +206,7 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader {
page.pm.PlayFromBeginning()
})
// TODO: find way to pad shuffle svg rather than using a space in the label string
shuffleBtn := widget.NewButtonWithIcon(" Shuffle", res.ResShuffleInvertSvg, func() {
shuffleBtn := widget.NewButtonWithIcon(" Shuffle", myTheme.ShuffleIcon, func() {
page.pm.LoadTracks(page.tracklist.Tracks, false /*append*/, true /*shuffle*/)
page.pm.PlayFromBeginning()
})
+2 -2
View File
@@ -2,10 +2,10 @@ package browsing
import (
"supersonic/backend"
"supersonic/res"
"supersonic/sharedutil"
"supersonic/ui/controller"
"supersonic/ui/layouts"
"supersonic/ui/theme"
"supersonic/ui/widgets"
"fyne.io/fyne/v2"
@@ -56,7 +56,7 @@ func NewTracksPage(contr *controller.Controller, conf *backend.TracksPageConfig,
t.title = widget.NewRichTextWithText("All Tracks")
t.title.Segments[0].(*widget.TextSegment).Style.SizeName = widget.RichTextStyleHeading.SizeName
t.playRandom = widget.NewButtonWithIcon("Play random", res.ResShuffleInvertSvg, t.playRandomSongs)
t.playRandom = widget.NewButtonWithIcon("Play random", theme.ShuffleIcon, t.playRandomSongs)
t.searcher = widgets.NewSearcher()
t.searcher.OnSearched = t.OnSearched
t.createContainer()