optionally colorized date extensions (due, threshold and again)

This commit is contained in:
Florian Tham
2018-11-06 10:58:18 +01:00
parent d589fd0570
commit 3bc3616651
3 changed files with 12 additions and 2 deletions

BIN
.todo.sh.swp Normal file

Binary file not shown.

View File

@@ -67,6 +67,10 @@ export REPORT_FILE="$TODO_DIR/report.txt"
# export COLOR_PROJECT=$RED
# export COLOR_CONTEXT=$RED
# ... and for date extensions (due:yyyy-mm-dd, t:yyyy-mm-dd and again:X)
#
# export COLOR_DATEEXT=$LIGHT_BLUE
# === BEHAVIOR ===
## customize list output

10
todo.sh
View File

@@ -644,9 +644,10 @@ export PRI_B=$GREEN # color for B priority
export PRI_C=$LIGHT_BLUE # color for C priority
export PRI_X=$WHITE # color unless explicitly defined
# Default project and context colors.
# Default project, context and dateext colors.
export COLOR_PROJECT=$NONE
export COLOR_CONTEXT=$NONE
export COLOR_DATEEXT=$NONE
# Default highlight colors.
export COLOR_DONE=$LIGHT_GREY # color for done (but not yet archived) tasks
@@ -964,6 +965,9 @@ _format()
ctx_beg = highlight("COLOR_CONTEXT")
ctx_end = (ctx_beg ? (highlight("DEFAULT") clr) : "")
dtx_beg = highlight("COLOR_DATEEXT")
dtx_end = (dtx_beg ? (highlight("DEFAULT") clr) : "")
gsub(/[ \t][ \t]*/, "\n&\n")
len = split($0, words, /\n/)
@@ -973,7 +977,9 @@ _format()
printf "%s", prj_beg words[i] prj_end
} else if (words[i] ~ /^[@].*[A-Za-z0-9_]$/) {
printf "%s", ctx_beg words[i] ctx_end
} else {
} else if (words[i] ~ /^(due|t|again):/) {
printf "%s", dtx_beg words[i] dtx_end
} else {
printf "%s", words[i]
}
}