Allowing a few hard coded colors to be configurable (#1405)
* making some hard coded colors configurable via skins * more flexible colors for logo messages * correct color formatting per MR comments * no need to convert to String --------- Co-authored-by: Cason Adams <cadams@roku.com>mine
parent
a5be038c99
commit
f41c22bce2
|
|
@ -61,9 +61,13 @@ type (
|
|||
|
||||
// Body tracks body styles.
|
||||
Body struct {
|
||||
FgColor Color `yaml:"fgColor"`
|
||||
BgColor Color `yaml:"bgColor"`
|
||||
LogoColor Color `yaml:"logoColor"`
|
||||
FgColor Color `yaml:"fgColor"`
|
||||
BgColor Color `yaml:"bgColor"`
|
||||
LogoColor Color `yaml:"logoColor"`
|
||||
LogoColorMsg Color `yaml:"logoColorMsg"`
|
||||
LogoColorInfo Color `yaml:"logoColorInfo"`
|
||||
LogoColorWarn Color `yaml:"logoColorWarn"`
|
||||
LogoColorError Color `yaml:"logoColorError"`
|
||||
}
|
||||
|
||||
// Dialog tracks dialog styles.
|
||||
|
|
@ -330,9 +334,13 @@ func newHelp() Help {
|
|||
|
||||
func newBody() Body {
|
||||
return Body{
|
||||
FgColor: "cadetblue",
|
||||
BgColor: "black",
|
||||
LogoColor: "orange",
|
||||
FgColor: "cadetblue",
|
||||
BgColor: "black",
|
||||
LogoColor: "orange",
|
||||
LogoColorMsg: "white",
|
||||
LogoColorInfo: "green",
|
||||
LogoColorWarn: "mediumvioletred",
|
||||
LogoColorError: "red",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,17 +67,17 @@ func (l *Logo) Reset() {
|
|||
|
||||
// Err displays a log error state.
|
||||
func (l *Logo) Err(msg string) {
|
||||
l.update(msg, config.NewColor("red"))
|
||||
l.update(msg, l.styles.Body().LogoColorError)
|
||||
}
|
||||
|
||||
// Warn displays a log warning state.
|
||||
func (l *Logo) Warn(msg string) {
|
||||
l.update(msg, config.NewColor("mediumvioletred"))
|
||||
l.update(msg, l.styles.Body().LogoColorWarn)
|
||||
}
|
||||
|
||||
// Info displays a log info state.
|
||||
func (l *Logo) Info(msg string) {
|
||||
l.update(msg, config.NewColor("green"))
|
||||
l.update(msg, l.styles.Body().LogoColorInfo)
|
||||
}
|
||||
|
||||
func (l *Logo) update(msg string, c config.Color) {
|
||||
|
|
@ -87,7 +87,9 @@ func (l *Logo) update(msg string, c config.Color) {
|
|||
|
||||
func (l *Logo) refreshStatus(msg string, c config.Color) {
|
||||
l.status.SetBackgroundColor(c.Color())
|
||||
l.status.SetText(fmt.Sprintf("[white::b]%s", msg))
|
||||
l.status.SetText(
|
||||
fmt.Sprintf("[%s::b]%s", l.styles.Body().LogoColorMsg, msg),
|
||||
)
|
||||
}
|
||||
|
||||
func (l *Logo) refreshLogo(c config.Color) {
|
||||
|
|
|
|||
|
|
@ -24,17 +24,17 @@ func TestLogoStatus(t *testing.T) {
|
|||
"info": {
|
||||
"[#008000::b] ____ __.________ \n[#008000::b]| |/ _/ __ \\______\n[#008000::b]| < \\____ / ___/\n[#008000::b]| | \\ / /\\___ \\ \n[#008000::b]|____|__ \\ /____//____ >\n[#008000::b] \\/ \\/ \n",
|
||||
"blee",
|
||||
"[white::b]blee\n",
|
||||
"[#ffffff::b]blee\n",
|
||||
},
|
||||
"warn": {
|
||||
"[#c71585::b] ____ __.________ \n[#c71585::b]| |/ _/ __ \\______\n[#c71585::b]| < \\____ / ___/\n[#c71585::b]| | \\ / /\\___ \\ \n[#c71585::b]|____|__ \\ /____//____ >\n[#c71585::b] \\/ \\/ \n",
|
||||
"blee",
|
||||
"[white::b]blee\n",
|
||||
"[#ffffff::b]blee\n",
|
||||
},
|
||||
"err": {
|
||||
"[#ff0000::b] ____ __.________ \n[#ff0000::b]| |/ _/ __ \\______\n[#ff0000::b]| < \\____ / ___/\n[#ff0000::b]| | \\ / /\\___ \\ \n[#ff0000::b]|____|__ \\ /____//____ >\n[#ff0000::b] \\/ \\/ \n",
|
||||
"blee",
|
||||
"[white::b]blee\n",
|
||||
"[#ffffff::b]blee\n",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue