1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Row color as common function

This commit is contained in:
Chris Cummer
2018-05-14 20:45:18 -07:00
parent 0d3b663642
commit 0ff65bbd5c
3 changed files with 13 additions and 22 deletions

View File

@@ -16,7 +16,7 @@ func (widget *Widget) display(clocks []Clock) {
for idx, clock := range clocks {
str = str + fmt.Sprintf(
" [%s]%-12s %-10s %7s[white]\n",
widget.rowColor(idx),
wtf.RowColor("clocks", idx),
clock.Label,
clock.LocalTime.Format(wtf.SimpleTimeFormat),
clock.LocalTime.Format(wtf.SimpleDateFormat),
@@ -25,13 +25,3 @@ func (widget *Widget) display(clocks []Clock) {
fmt.Fprintf(widget.View, "%s", str)
}
func (widget *Widget) rowColor(idx int) string {
rowCol := Config.UString("wtf.mods.clocks.colors.row.even", "lightblue")
if idx%2 == 0 {
rowCol = Config.UString("wtf.mods.clocks.colors.row.odd", "white")
}
return rowCol
}