beginning of moving custom icons to theme
This commit is contained in:
@@ -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,8 +54,27 @@ 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 {
|
||||
switch style {
|
||||
|
||||
Reference in New Issue
Block a user