Fix UDA colors

This commit is contained in:
Martin
2024-05-31 13:40:49 +02:00
parent 035d09900e
commit 9aa7b04b98
8 changed files with 110 additions and 39 deletions

View File

@ -1,6 +1,7 @@
package table
import (
"fmt"
"strings"
"time"
@ -189,6 +190,18 @@ func (m *Model) parseRowStyles(rows taskwarrior.Tasks) []lipgloss.Style {
styles[i] = m.common.Styles.Recurring.Inherit(m.styles.Cell).Margin(m.styles.Cell.GetMargin()).Padding(m.styles.Cell.GetPadding())
continue
}
// TOOD: move udas to proper location
if len(m.common.Udas) > 0 {
for _, uda := range m.common.Udas {
if u, ok := task.Udas[uda]; ok {
if style, ok := m.common.Styles.Colors[fmt.Sprintf("uda.%s.%s", uda, u)]; ok {
styles[i] = style.Inherit(m.styles.Cell).Margin(m.styles.Cell.GetMargin()).Padding(m.styles.Cell.GetPadding())
}
}
}
continue
}
// TODO: make styles optional and discard if empty
if len(task.Tags) > 0 {
styles[i] = m.common.Styles.Tagged.Inherit(m.styles.Cell).Margin(m.styles.Cell.GetMargin()).Padding(m.styles.Cell.GetPadding())
taskIteration:
@ -200,7 +213,6 @@ func (m *Model) parseRowStyles(rows taskwarrior.Tasks) []lipgloss.Style {
}
continue
}
// TODO implement uda
styles[i] = m.common.Styles.Base.Inherit(m.styles.Cell).Margin(m.styles.Cell.GetMargin()).Padding(m.styles.Cell.GetPadding())
}
return styles