mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Colorization - color.recurring
- Added support for "color.recurring" configuration variable to colorize recurring tasks. - Updated docs.
This commit is contained in:
parent
17de9fec9f
commit
1999e38ba5
5 changed files with 41 additions and 24 deletions
|
@ -31,6 +31,8 @@
|
||||||
+ Fixed bug that concatenated a modified description without spaces.
|
+ Fixed bug that concatenated a modified description without spaces.
|
||||||
+ Added new column 'recur' that displays the recurrence period of any
|
+ Added new column 'recur' that displays the recurrence period of any
|
||||||
recurring tasks. This column can be added to any custom report.
|
recurring tasks. This column can be added to any custom report.
|
||||||
|
+ Added support for "color.recurring" configuration variable which
|
||||||
|
specifies the color of recurring tasks.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,8 @@
|
||||||
color.pri.L<br />
|
color.pri.L<br />
|
||||||
color.pri.none<br />
|
color.pri.none<br />
|
||||||
color.active<br />
|
color.active<br />
|
||||||
color.tagged
|
color.tagged<br />
|
||||||
|
color.recurring
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
These are the coloration rules. They correspond to a particular
|
These are the coloration rules. They correspond to a particular
|
||||||
|
|
|
@ -125,6 +125,8 @@
|
||||||
<li>Fixed bug that concatenated a modified description without spaces.
|
<li>Fixed bug that concatenated a modified description without spaces.
|
||||||
<li>Added new column 'recur' that displays the recurrence period of any
|
<li>Added new column 'recur' that displays the recurrence period of any
|
||||||
recurring tasks. This column can be added to any custom report.
|
recurring tasks. This column can be added to any custom report.
|
||||||
|
<li>Added support for "color.recurring" configuration variable which
|
||||||
|
specifies the color of recurring tasks.
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -144,6 +144,7 @@ void Config::createDefault (const std::string& home)
|
||||||
fprintf (out, "#color.tag.bug=yellow\n");
|
fprintf (out, "#color.tag.bug=yellow\n");
|
||||||
fprintf (out, "#color.project.garden=on_green\n");
|
fprintf (out, "#color.project.garden=on_green\n");
|
||||||
fprintf (out, "#color.keyword.car=on_blue\n");
|
fprintf (out, "#color.keyword.car=on_blue\n");
|
||||||
|
fprintf (out, "#color.recurring=on_red\n");
|
||||||
fprintf (out, "#shadow.file=%s/shadow.txt\n", dataDir.c_str ());
|
fprintf (out, "#shadow.file=%s/shadow.txt\n", dataDir.c_str ());
|
||||||
fprintf (out, "#shadow.command=list\n");
|
fprintf (out, "#shadow.command=list\n");
|
||||||
fprintf (out, "#shadow.notify=on\n");
|
fprintf (out, "#shadow.notify=on\n");
|
||||||
|
|
|
@ -89,6 +89,17 @@ void autoColorize (
|
||||||
// Note: fg, bg already contain colors specifically assigned via command.
|
// Note: fg, bg already contain colors specifically assigned via command.
|
||||||
// Note: These rules form a hierarchy - the last rule is king.
|
// Note: These rules form a hierarchy - the last rule is king.
|
||||||
|
|
||||||
|
// Colorization of the recurring.
|
||||||
|
if (gsFg["color.recurring"] != Text::nocolor ||
|
||||||
|
gsBg["color.recurring"] != Text::nocolor)
|
||||||
|
{
|
||||||
|
if (task.getAttribute ("recur") != "")
|
||||||
|
{
|
||||||
|
fg = gsFg["color.recurring"];
|
||||||
|
bg = gsBg["color.recurring"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Colorization of the tagged.
|
// Colorization of the tagged.
|
||||||
if (gsFg["color.tagged"] != Text::nocolor ||
|
if (gsFg["color.tagged"] != Text::nocolor ||
|
||||||
gsBg["color.tagged"] != Text::nocolor)
|
gsBg["color.tagged"] != Text::nocolor)
|
||||||
|
@ -157,29 +168,6 @@ void autoColorize (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Colorization of the due and overdue.
|
|
||||||
std::string due = task.getAttribute ("due");
|
|
||||||
if (due != "")
|
|
||||||
{
|
|
||||||
Date dueDate (::atoi (due.c_str ()));
|
|
||||||
Date now;
|
|
||||||
Date then (now + conf.get ("due", 7) * 86400);
|
|
||||||
|
|
||||||
// Overdue
|
|
||||||
if (dueDate < now)
|
|
||||||
{
|
|
||||||
fg = gsFg["color.overdue"];
|
|
||||||
bg = gsBg["color.overdue"];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Imminent
|
|
||||||
else if (dueDate < then)
|
|
||||||
{
|
|
||||||
fg = gsFg["color.due"];
|
|
||||||
bg = gsBg["color.due"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Colorization by tag value.
|
// Colorization by tag value.
|
||||||
std::map <std::string, Text::color>::iterator it;
|
std::map <std::string, Text::color>::iterator it;
|
||||||
for (it = gsFg.begin (); it != gsFg.end (); ++it)
|
for (it = gsFg.begin (); it != gsFg.end (); ++it)
|
||||||
|
@ -223,6 +211,29 @@ void autoColorize (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Colorization of the due and overdue.
|
||||||
|
std::string due = task.getAttribute ("due");
|
||||||
|
if (due != "")
|
||||||
|
{
|
||||||
|
Date dueDate (::atoi (due.c_str ()));
|
||||||
|
Date now;
|
||||||
|
Date then (now + conf.get ("due", 7) * 86400);
|
||||||
|
|
||||||
|
// Overdue
|
||||||
|
if (dueDate < now)
|
||||||
|
{
|
||||||
|
fg = gsFg["color.overdue"];
|
||||||
|
bg = gsBg["color.overdue"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Imminent
|
||||||
|
else if (dueDate < then)
|
||||||
|
{
|
||||||
|
fg = gsFg["color.due"];
|
||||||
|
bg = gsBg["color.due"];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue