mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
* 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>
45 lines
833 B
Go
45 lines
833 B
Go
package todoist
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/rivo/tview"
|
|
"github.com/wtfutil/wtf/utils"
|
|
)
|
|
|
|
func (widget *Widget) content() (string, string, bool) {
|
|
proj := widget.CurrentProject()
|
|
|
|
if proj == nil {
|
|
return widget.CommonSettings().Title, "", false
|
|
}
|
|
|
|
if proj.err != nil {
|
|
return widget.CommonSettings().Title, proj.err.Error(), true
|
|
}
|
|
|
|
title := fmt.Sprintf(
|
|
"[%s]%s[white]",
|
|
widget.settings.common.Colors.TextTheme.Title,
|
|
proj.Project.Name,
|
|
)
|
|
|
|
str := ""
|
|
|
|
for idx, item := range proj.tasks {
|
|
row := fmt.Sprintf(
|
|
`[%s]| | %s[%s]`,
|
|
widget.RowColor(idx),
|
|
tview.Escape(item.Content),
|
|
widget.RowColor(idx),
|
|
)
|
|
|
|
str += utils.HighlightableHelper(widget.View, row, idx, len(item.Content))
|
|
}
|
|
return title, str, false
|
|
}
|
|
|
|
func (widget *Widget) display() {
|
|
widget.ScrollableWidget.Redraw(widget.content)
|
|
}
|