- Added feature #340, which implements new color rules 'color.completed' and
  'color.deleted'.
This commit is contained in:
Paul Beckingham 2011-07-09 19:00:58 -04:00
parent 7986227ea2
commit 10b97fc967
6 changed files with 33 additions and 2 deletions

View file

@ -41,6 +41,8 @@
# Tracked Features, sorted by ID.
+ Added feature #278, which provides a more consistent command line grammar.
+ Added feature #330, which supports the 'inverse' color attribute.
+ Added feature #340, which implements new color rules 'color.completed' and
'color.deleted'.
+ Added feature #479, which enables filtering for the 'calendar' command.
+ Added feature #496, which allows rc.default.command to be supplemented with
a filter, so that 'task project:Home' applies the project filter to the

1
NEWS
View file

@ -52,6 +52,7 @@ New configuration options in taskwarrior 2.0.0
or simple text patterns.
- New 'exit.on.missing.db' control causes an exit if the ~/.task directory
(or override) is missing.
- New 'color.completed' and 'color.deleted' color rules.
Newly deprecated features in taskwarrior 2.0.0

View file

@ -699,6 +699,12 @@ Task has priority L.
.br
.B color.pri.none
Task has no priority.
.br
.B color.completed
Task is completed.
.br
.B color.deleted
Task is deleted.
.RE
.RE
@ -850,7 +856,7 @@ Colors the output of the merge command.
.RE
.TP
.B rule.precedence.color=due.today,active,blocked,overdue,due,keyword,project,tag,recurring,pri,tagged
.B rule.precedence.color=due.today,active,blocked,overdue,due,keyword,project,tag,recurring,pri,tagged,completed,deleted
.RS
This setting specifies the precedence of the color rules, from highest to
lowest. Note that the prefix 'color.' is omitted (for brevity), and that any

View file

@ -197,6 +197,8 @@ std::string Config::defaults =
"color.pri.L=rgb245 # Color of priority:L tasks\n"
"color.tagged=rgb031 # Color of tagged tasks\n"
"color.blocked=white on color8 # Color of blocked tasks\n"
"#color.completed=on blue # Color of completed tasks\n"
"#color.deleted=on blue # Color of deleted tasks\n"
#else
"color.header=yellow # Color of header messages\n"
"color.footnote=yellow # Color of footnote messages\n"
@ -246,12 +248,14 @@ std::string Config::defaults =
"color.pri.L= # Color of priority:L tasks\n"
"color.tagged=green # Color of tagged tasks\n"
"color.blocked=black on white # Color of blocked tasks\n"
"#color.completed=on blue # Color of completed tasks\n"
"#color.deleted=on blue # Color of deleted tasks\n"
#endif
"\n"
"# Here is the rule precedence order, highest to lowest.\n"
"# Note that these are just the color rule names, without the leading 'color.'\n"
"# and any trailing '.value'.\n"
"rule.precedence.color=due.today,active,blocked,overdue,due,keyword,project,tag,recurring,pri,tagged\n"
"rule.precedence.color=due.today,active,blocked,overdue,due,keyword,project,tag,recurring,pri,tagged,completed,deleted\n"
"\n"
"# Shadow file support\n"
"#shadow.file=/tmp/shadow.txt # Location of shadow file\n"

View file

@ -92,7 +92,9 @@ int CmdShow::execute (std::string& output)
" color.calendar.today"
" color.calendar.weekend"
" color.calendar.weeknumber"
" color.completed"
" color.debug"
" color.deleted"
" color.due"
" color.due.today"
" color.footnote"

View file

@ -253,6 +253,20 @@ static void colorizeRecurring (Task& task, const std::string& rule, Color& c)
c.blend (gsColor[rule]);
}
////////////////////////////////////////////////////////////////////////////////
static void colorizeCompleted (Task& task, const std::string& rule, Color& c)
{
if (task.getStatus () == Task::completed)
c.blend (gsColor[rule]);
}
////////////////////////////////////////////////////////////////////////////////
static void colorizeDeleted (Task& task, const std::string& rule, Color& c)
{
if (task.getStatus () == Task::completed)
c.blend (gsColor[rule]);
}
////////////////////////////////////////////////////////////////////////////////
void autoColorize (Task& task, Color& c)
{
@ -283,6 +297,8 @@ void autoColorize (Task& task, Color& c)
else if (*r == "color.due.today") colorizeDueToday (task, *r, c);
else if (*r == "color.overdue") colorizeOverdue (task, *r, c);
else if (*r == "color.recurring") colorizeRecurring (task, *r, c);
else if (*r == "color.completed") colorizeCompleted (task, *r, c);
else if (*r == "color.deleted") colorizeDeleted (task, *r, c);
// Wildcards
else if (r->substr (0, 9) == "color.tag") colorizeTag (task, *r, c);