mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-30 02:17:21 +02:00
color.due.today and color.calendar.due.today
- tasks due on the current day ("today") can now be colorized with their own color. - this is for reports and the calendar
This commit is contained in:
parent
adb72ef023
commit
4adfec4482
8 changed files with 131 additions and 29 deletions
|
@ -1473,6 +1473,7 @@ std::string renderMonths (
|
|||
|
||||
Color color_today (context.config.get ("color.calendar.today"));
|
||||
Color color_due (context.config.get ("color.calendar.due"));
|
||||
Color color_duetoday (context.config.get ("color.calendar.due.today"));
|
||||
Color color_overdue (context.config.get ("color.calendar.overdue"));
|
||||
Color color_weekend (context.config.get ("color.calendar.weekend"));
|
||||
Color color_holiday (context.config.get ("color.calendar.holiday"));
|
||||
|
@ -1542,19 +1543,44 @@ std::string renderMonths (
|
|||
|
||||
// colorize due tasks
|
||||
if (context.config.get ("calendar.details") != "none")
|
||||
{
|
||||
context.config.set ("due", 0);
|
||||
foreach (task, all)
|
||||
{
|
||||
|
||||
|
||||
if (task->getStatus () == Task::pending &&
|
||||
task->has ("due"))
|
||||
{
|
||||
Date due (atoi (task->get ("due").c_str ()));
|
||||
std::string due = task->get ("due");
|
||||
Date duedmy (atoi(due.c_str()));
|
||||
|
||||
if (due.day () == d &&
|
||||
due.month () == months[mpl] &&
|
||||
due.year () == years[mpl])
|
||||
table.setCellColor (row, thisCol, (due < today ? color_overdue : color_due));
|
||||
if (duedmy.day () == d &&
|
||||
duedmy.month () == months[mpl] &&
|
||||
duedmy.year () == years[mpl])
|
||||
{
|
||||
switch (getDueState (due))
|
||||
{
|
||||
case 1: // imminent
|
||||
table.setCellColor (row, thisCol, color_due);
|
||||
break;
|
||||
|
||||
case 2: // today
|
||||
table.setCellColor (row, thisCol, color_duetoday);
|
||||
break;
|
||||
|
||||
case 3: // overdue
|
||||
table.setCellColor (row, thisCol, color_overdue);
|
||||
break;
|
||||
|
||||
case 0: // not due at all
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for end of week, and...
|
||||
|
@ -1741,6 +1767,7 @@ int handleReportCalendar (std::string &outs)
|
|||
|
||||
Color color_today (context.config.get ("color.calendar.today"));
|
||||
Color color_due (context.config.get ("color.calendar.due"));
|
||||
Color color_duetoday (context.config.get ("color.calendar.due.today"));
|
||||
Color color_overdue (context.config.get ("color.calendar.overdue"));
|
||||
Color color_weekend (context.config.get ("color.calendar.weekend"));
|
||||
Color color_holiday (context.config.get ("color.calendar.holiday"));
|
||||
|
@ -1753,6 +1780,8 @@ int handleReportCalendar (std::string &outs)
|
|||
<< ", "
|
||||
<< color_due.colorize ("due")
|
||||
<< ", "
|
||||
<< color_duetoday.colorize ("due-today")
|
||||
<< ", "
|
||||
<< color_overdue.colorize ("overdue")
|
||||
<< ", "
|
||||
<< color_weekend.colorize ("weekend")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue