beginning of moving custom icons to theme

This commit is contained in:
Drew Weymouth
2023-05-01 17:34:23 -07:00
parent 118b19aa13
commit dd1adaf2a2
+31
View File
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"log"
"strings"
"supersonic/res"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
@@ -23,6 +24,17 @@ type MyTheme struct {
BoldFont string
}
const (
IconNameNowPlaying fyne.ThemeIconName = "NowPlaying"
IconNameFavorite fyne.ThemeIconName = "Favorite"
IconNameNotFavorite fyne.ThemeIconName = "NotFavorite"
IconNameAlbum fyne.ThemeIconName = "Album"
IconNameArtist fyne.ThemeIconName = "Artist"
IconNameGenre fyne.ThemeIconName = "Genre"
IconNamePlaylist fyne.ThemeIconName = "Playlist"
IconNameShuffle fyne.ThemeIconName = "Shuffle"
)
var _ fyne.Theme = (*MyTheme)(nil)
func (m *MyTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
@@ -42,7 +54,26 @@ func (m *MyTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) col
}
func (m *MyTheme) Icon(name fyne.ThemeIconName) fyne.Resource {
switch name {
case IconNameAlbum:
return res.ResDiscInvertPng
case IconNameArtist:
return res.ResPeopleInvertPng
case IconNameFavorite:
return res.ResHeartFilledInvertPng
case IconNameNotFavorite:
return res.ResHeartOutlineInvertPng
case IconNameGenre:
return res.ResTheatermasksInvertPng
case IconNameNowPlaying:
return res.ResHeadphonesInvertPng
case IconNamePlaylist:
return res.ResPlaylistInvertPng
case IconNameShuffle:
return res.ResShuffleInvertSvg
default:
return theme.DefaultTheme().Icon(name)
}
}
func (m *MyTheme) Font(style fyne.TextStyle) fyne.Resource {