diff --git a/ChangeLog b/ChangeLog index b55c567dc..4b5a15bd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,6 +36,9 @@ + Added 2 new configuration variables to display the details of tasks with due dates when doing a 'task cal' for the corresponding months: 'calendar.details' and 'calendar.details.report' + + Added 3 new color configuration variables to colorize today, days with due tasks + and days with overdue tasks in the calendar: + 'calendar.color.today', 'color.calendar.due' and 'calendar.calendar.overdue' + Fixed bug #316 which caused the timesheet report to display an oddly sorted list. + Fixed bug #317 which colored tasks in the 'completed' report according to diff --git a/doc/man/taskrc.5 b/doc/man/taskrc.5 index 73f7b334d..edb5ab6aa 100644 --- a/doc/man/taskrc.5 +++ b/doc/man/taskrc.5 @@ -300,6 +300,18 @@ Colors any of the messages printed after the report output. .TP .B color.footnote=green Colors any of the messages printed last. + +.TP +.B color.calendar.today=cyan +Color of today in calendar. + +.TP +.B color.calendar.due=black on yellow +Color of days with due tasks in calendar. + +.TP +.B color.calendar.overdue=black on red +Color of days with overdue tasks in calendar .RE .SS SHADOW FILE diff --git a/src/Config.cpp b/src/Config.cpp index 6d7da7ba6..d9359a8b7 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -172,6 +172,9 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data) << "#color.recurring=on_red # Color of recur.any: tasks\n" << "#color.header=bold_green # Color of header messages\n" << "#color.footnote=bold_green # Color of footnote messages\n" + << "color.calendar.today=cyan # Color of today in calendar\n" + << "color.calendar.due=black on yellow # Color of days with due tasks in calendar\n" + << "color.calendar.overdue=black on red # Color of days with overdue tasks in calendar\n" << "\n" << "#shadow.file=/tmp/shadow.txt # Location of shadow file\n" << "#shadow.command=list # Task command for shadow file\n" diff --git a/src/command.cpp b/src/command.cpp index f4394cfa1..30fda1dd8 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -554,6 +554,7 @@ int handleConfig (std::string &outs) " blanklines bulk calendar.details calendar.details.report color color.active " "color.due color.overdue color.pri.H color.pri.L color.pri.M color.pri.none " "color.recurring color.tagged color.footnote color.header color.debug color.alternate " + "color.calendar.today color.calendar.due color.calendar.overdue " "confirmation curses data.location dateformat debug default.command default.priority " "default.project defaultwidth due locale displayweeknumber echo.command " "locking monthsperline nag next project shadow.command shadow.file " diff --git a/src/report.cpp b/src/report.cpp index 7b748669a..6e026d4fd 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -1430,11 +1430,15 @@ std::string renderMonths ( table.addCell (row, thisCol, d); + Color color_today (context.config.get ("color.calendar.today", "cyan")); + Color color_due (context.config.get ("color.calendar.due", "black on yellow")); + Color color_overdue (context.config.get ("color.calendar.overdue", "black on red")); + if ((context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false)) && today.day () == d && today.month () == months.at (mpl) && today.year () == years.at (mpl)) - table.setCellColor (row, thisCol, Color (Color::cyan)); + table.setCellColor (row, thisCol, color_today); foreach (task, all) { @@ -1447,10 +1451,7 @@ std::string renderMonths ( due.day () == d && due.month () == months[mpl] && due.year () == years[mpl]) - { - Color c (Color::black, (due < today ? Color::red : Color::yellow)); - table.setCellColor (row, thisCol, c); - } + table.setCellColor (row, thisCol, (due < today ? color_overdue : color_due)); } } @@ -1632,9 +1633,9 @@ int handleReportCalendar (std::string &outs) } } - Color color_today (Color::cyan); - Color color_due (Color::black, Color::yellow); - Color color_overdue (Color::black, Color::red); + Color color_today (context.config.get ("color.calendar.today", "cyan")); + Color color_due (context.config.get ("color.calendar.due", "black on yellow")); + Color color_overdue (context.config.get ("color.calendar.overdue", "black on red")); if (context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false)) out << "Legend: " diff --git a/src/tests/cal.t b/src/tests/cal.t index 1bff4ce47..fe7e5c6b2 100755 --- a/src/tests/cal.t +++ b/src/tests/cal.t @@ -30,7 +30,7 @@ use strict; use warnings; -use Test::More tests => 36; +use Test::More tests => 58; # Create the rc file. if (open my $fh, '>', 'cal.rc')