mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Provide Spotify color customization settings
This commit is contained in:
parent
658718d166
commit
1a13bc2420
@ -10,7 +10,13 @@ const (
|
|||||||
defaultTitle = "Spotify"
|
defaultTitle = "Spotify"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type colors struct {
|
||||||
|
label string
|
||||||
|
text string
|
||||||
|
}
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
|
colors
|
||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,5 +25,8 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
|||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings.colors.label = ymlConfig.UString("colors.label", "green")
|
||||||
|
settings.colors.text = ymlConfig.UString("colors.text", "white")
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
|
@ -64,10 +64,13 @@ func (w *Widget) createOutput() (string, string, bool) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
content = err.Error()
|
content = err.Error()
|
||||||
} else {
|
} else {
|
||||||
content = utils.CenterText(fmt.Sprintf("[green]Now %v [white]\n", w.Info.Status), w.CommonSettings().Width)
|
labelColor := w.settings.colors.label
|
||||||
content += utils.CenterText(fmt.Sprintf("[green]Title:[white] %v\n ", w.Info.Title), w.CommonSettings().Width)
|
textColor := w.settings.colors.text
|
||||||
content += utils.CenterText(fmt.Sprintf("[green]Artist:[white] %v\n", w.Info.Artist), w.CommonSettings().Width)
|
|
||||||
content += utils.CenterText(fmt.Sprintf("[green]%v:[white] %v\n", w.Info.TrackNumber, w.Info.Album), w.CommonSettings().Width)
|
content = utils.CenterText(fmt.Sprintf("[%s]Now %v [%s]\n", labelColor, w.Info.Status, textColor), w.CommonSettings().Width)
|
||||||
|
content += utils.CenterText(fmt.Sprintf("[%s]Title:[%s] %v\n ", labelColor, textColor, w.Info.Title), w.CommonSettings().Width)
|
||||||
|
content += utils.CenterText(fmt.Sprintf("[%s]Artist:[%s] %v\n", labelColor, textColor, w.Info.Artist), w.CommonSettings().Width)
|
||||||
|
content += utils.CenterText(fmt.Sprintf("[%s]%v:[%s] %v\n", labelColor, w.Info.TrackNumber, textColor, w.Info.Album), w.CommonSettings().Width)
|
||||||
}
|
}
|
||||||
return w.CommonSettings().Title, content, true
|
return w.CommonSettings().Title, content, true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user