mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-730 Fix missing color key config error (#738)
* WTF-730 Fix missing color key config error Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Add Subheading color formatting to modules Users can now set a `subheading` color in their config to change the color of subheadings in widget display. Defaults to `red`. Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Fix oustanding color issues Clean up missing color config changes not addressed in earlier commits. Signed-off-by: Chris Cummer <chriscummer@me.com> * Remove unused dependency Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Base cleanup Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Fix a few bugs related to color config changes Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Fix issues with PagerDuty subheading display Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Fix bug with Todo list colour rendering Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -107,12 +107,12 @@ func (widget *BarGraph) TextView() *tview.TextView {
|
||||
func (widget *BarGraph) createView(bordered bool) *tview.TextView {
|
||||
view := tview.NewTextView()
|
||||
|
||||
view.SetBackgroundColor(wtf.ColorFor(widget.commonSettings.Colors.Background))
|
||||
view.SetBackgroundColor(wtf.ColorFor(widget.commonSettings.Colors.WidgetTheme.Background))
|
||||
view.SetBorder(bordered)
|
||||
view.SetBorderColor(wtf.ColorFor(widget.BorderColor()))
|
||||
view.SetDynamicColors(true)
|
||||
view.SetTitle(widget.ContextualTitle(widget.CommonSettings().Title))
|
||||
view.SetTitleColor(wtf.ColorFor(widget.commonSettings.Colors.Title))
|
||||
view.SetTitleColor(wtf.ColorFor(widget.commonSettings.Colors.TextTheme.Title))
|
||||
view.SetWrap(false)
|
||||
|
||||
return view
|
||||
|
||||
11
view/base.go
11
view/base.go
@@ -47,12 +47,13 @@ func (base *Base) Bordered() bool {
|
||||
return base.bordered
|
||||
}
|
||||
|
||||
// BorderColor returns the color that the border of this widget should be drawn in
|
||||
func (base *Base) BorderColor() string {
|
||||
if base.Focusable() {
|
||||
return base.commonSettings.Colors.BorderFocusable
|
||||
return base.commonSettings.Colors.BorderTheme.Focusable
|
||||
}
|
||||
|
||||
return base.commonSettings.Colors.BorderNormal
|
||||
return base.commonSettings.Colors.BorderTheme.Unfocusable
|
||||
}
|
||||
|
||||
func (base *Base) CommonSettings() *cfg.Common {
|
||||
@@ -69,10 +70,10 @@ func (base *Base) ContextualTitle(defaultStr string) string {
|
||||
} else if defaultStr != "" && base.FocusChar() == "" {
|
||||
return fmt.Sprintf(" %s ", defaultStr)
|
||||
} else if defaultStr == "" && base.FocusChar() != "" {
|
||||
return fmt.Sprintf(" [darkgray::u]%s[::-][green] ", base.FocusChar())
|
||||
} else {
|
||||
return fmt.Sprintf(" %s [darkgray::u]%s[::-][green] ", defaultStr, base.FocusChar())
|
||||
return fmt.Sprintf(" [darkgray::u]%s[::-][white] ", base.FocusChar())
|
||||
}
|
||||
|
||||
return fmt.Sprintf(" %s [darkgray::u]%s[::-][white] ", defaultStr, base.FocusChar())
|
||||
}
|
||||
|
||||
func (base *Base) Disable() {
|
||||
|
||||
@@ -44,12 +44,12 @@ func (widget *TextWidget) Redraw(data func() (string, string, bool)) {
|
||||
func (widget *TextWidget) createView(bordered bool) *tview.TextView {
|
||||
view := tview.NewTextView()
|
||||
|
||||
view.SetBackgroundColor(wtf.ColorFor(widget.commonSettings.Colors.Background))
|
||||
view.SetBackgroundColor(wtf.ColorFor(widget.commonSettings.Colors.WidgetTheme.Background))
|
||||
view.SetBorder(bordered)
|
||||
view.SetBorderColor(wtf.ColorFor(widget.BorderColor()))
|
||||
view.SetDynamicColors(true)
|
||||
view.SetTextColor(wtf.ColorFor(widget.commonSettings.Colors.Text))
|
||||
view.SetTitleColor(wtf.ColorFor(widget.commonSettings.Colors.Title))
|
||||
view.SetTextColor(wtf.ColorFor(widget.commonSettings.Colors.TextTheme.Text))
|
||||
view.SetTitleColor(wtf.ColorFor(widget.commonSettings.Colors.TextTheme.Title))
|
||||
view.SetWrap(false)
|
||||
|
||||
return view
|
||||
|
||||
Reference in New Issue
Block a user