change icon color rather than button color to indicate "active" buttons

This commit is contained in:
Drew Weymouth
2024-01-06 15:42:30 -08:00
parent 9c2f72d9f2
commit 9b97347ad8
2 changed files with 13 additions and 7 deletions
+4 -3
View File
@@ -38,7 +38,7 @@ func NewAlbumFilterButton(filter *mediaprovider.AlbumFilter, fetchGenresFunc fun
a := &AlbumFilterButton{ a := &AlbumFilterButton{
filter: filter, filter: filter,
Button: widget.Button{ Button: widget.Button{
Icon: myTheme.FilterIcon, Icon: theme.NewThemedResource(myTheme.FilterIcon),
}, },
} }
a.OnTapped = a.showFilterDialog a.OnTapped = a.showFilterDialog
@@ -57,10 +57,11 @@ func NewAlbumFilterButton(filter *mediaprovider.AlbumFilter, fetchGenresFunc fun
} }
func (a *AlbumFilterButton) Refresh() { func (a *AlbumFilterButton) Refresh() {
themedIcon := a.Icon.(*theme.ThemedResource)
if a.filterEmpty() { if a.filterEmpty() {
a.Importance = widget.MediumImportance themedIcon.ColorName = theme.ColorNameForeground
} else { } else {
a.Importance = widget.HighImportance themedIcon.ColorName = theme.ColorNamePrimary
} }
a.Button.Refresh() a.Button.Refresh()
} }
+9 -4
View File
@@ -12,6 +12,11 @@ import (
"github.com/dweymouth/supersonic/ui/util" "github.com/dweymouth/supersonic/ui/util"
) )
var (
repeatThemedResource = theme.NewThemedResource(myTheme.RepeatIcon)
repeatOneThemedResource = theme.NewThemedResource(myTheme.RepeatOneIcon)
)
// The "aux" controls for playback, positioned to the right // The "aux" controls for playback, positioned to the right
// of the BottomPanel. Currently only volume control. // of the BottomPanel. Currently only volume control.
type AuxControls struct { type AuxControls struct {
@@ -70,11 +75,11 @@ func (a *AuxControls) OnChangeLoopMode(f func()) {
func (a *AuxControls) SetLoopMode(mode backend.LoopMode) { func (a *AuxControls) SetLoopMode(mode backend.LoopMode) {
switch mode { switch mode {
case backend.LoopAll: case backend.LoopAll:
a.loop.Importance = widget.HighImportance a.loop.Icon = repeatThemedResource
a.loop.Icon = myTheme.RepeatIcon repeatThemedResource.ColorName = theme.ColorNamePrimary
case backend.LoopOne: case backend.LoopOne:
a.loop.Importance = widget.HighImportance a.loop.Icon = repeatOneThemedResource
a.loop.Icon = myTheme.RepeatOneIcon repeatOneThemedResource.ColorName = theme.ColorNamePrimary
case backend.LoopNone: case backend.LoopNone:
a.loop.Importance = widget.MediumImportance a.loop.Importance = widget.MediumImportance
a.loop.Icon = myTheme.RepeatIcon a.loop.Icon = myTheme.RepeatIcon