mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Calendar coloring
- Added 1 new color configuration variables to colorize weekend days in the calendar: 'calendar.color.weekend'. - Changed the default colors in the calendar.
This commit is contained in:
parent
d552b208dd
commit
7ef5233547
6 changed files with 41 additions and 24 deletions
|
@ -36,9 +36,10 @@
|
||||||
+ Added 2 new configuration variables to display the details of tasks with due
|
+ Added 2 new configuration variables to display the details of tasks with due
|
||||||
dates when doing a 'task cal' for the corresponding months:
|
dates when doing a 'task cal' for the corresponding months:
|
||||||
'calendar.details' and 'calendar.details.report'
|
'calendar.details' and 'calendar.details.report'
|
||||||
+ Added 3 new color configuration variables to colorize today, days with due tasks
|
+ Added 4 new color configuration variables to colorize today, days with due tasks,
|
||||||
and days with overdue tasks in the calendar:
|
days with overdue tasks and weekend days in the calendar:
|
||||||
'calendar.color.today', 'color.calendar.due' and 'calendar.calendar.overdue'
|
'calendar.color.today', 'color.calendar.due',
|
||||||
|
'calendar.calendar.overdue' and 'color.calendar.weekend'.
|
||||||
+ Fixed bug #316 which caused the timesheet report to display an oddly sorted
|
+ Fixed bug #316 which caused the timesheet report to display an oddly sorted
|
||||||
list.
|
list.
|
||||||
+ Fixed bug #317 which colored tasks in the 'completed' report according to
|
+ Fixed bug #317 which colored tasks in the 'completed' report according to
|
||||||
|
|
|
@ -302,16 +302,20 @@ Colors any of the messages printed after the report output.
|
||||||
Colors any of the messages printed last.
|
Colors any of the messages printed last.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B color.calendar.today=cyan
|
.B color.calendar.today=black on cyan
|
||||||
Color of today in calendar.
|
Color of today in calendar.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B color.calendar.due=black on yellow
|
.B color.calendar.due=black on green
|
||||||
Color of days with due tasks in calendar.
|
Color of days with due tasks in calendar.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B color.calendar.overdue=black on red
|
.B color.calendar.overdue=black on red
|
||||||
Color of days with overdue tasks in calendar
|
Color of days with overdue tasks in calendar.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B color.calendar.weekend=black on white
|
||||||
|
Color of weekend days in calendar.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.SS SHADOW FILE
|
.SS SHADOW FILE
|
||||||
|
|
|
@ -172,9 +172,10 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data)
|
||||||
<< "#color.recurring=on_red # Color of recur.any: tasks\n"
|
<< "#color.recurring=on_red # Color of recur.any: tasks\n"
|
||||||
<< "#color.header=bold_green # Color of header messages\n"
|
<< "#color.header=bold_green # Color of header messages\n"
|
||||||
<< "#color.footnote=bold_green # Color of footnote messages\n"
|
<< "#color.footnote=bold_green # Color of footnote messages\n"
|
||||||
<< "color.calendar.today=cyan # Color of today in calendar\n"
|
<< "color.calendar.today=black on cyan # Color of today in calendar\n"
|
||||||
<< "color.calendar.due=black on yellow # Color of days with due tasks in calendar\n"
|
<< "color.calendar.due=black on green # Color of days with due tasks in calendar\n"
|
||||||
<< "color.calendar.overdue=black on red # Color of days with overdue tasks in calendar\n"
|
<< "color.calendar.overdue=black on red # Color of days with overdue tasks in calendar\n"
|
||||||
|
<< "color.calendar.weekend=black on white # Color of weekend days in calendar\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "#shadow.file=/tmp/shadow.txt # Location of shadow file\n"
|
<< "#shadow.file=/tmp/shadow.txt # Location of shadow file\n"
|
||||||
<< "#shadow.command=list # Task command for shadow file\n"
|
<< "#shadow.command=list # Task command for shadow file\n"
|
||||||
|
|
|
@ -554,7 +554,7 @@ int handleConfig (std::string &outs)
|
||||||
" blanklines bulk calendar.details calendar.details.report color color.active "
|
" 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.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.recurring color.tagged color.footnote color.header color.debug color.alternate "
|
||||||
"color.calendar.today color.calendar.due color.calendar.overdue "
|
"color.calendar.today color.calendar.due color.calendar.overdue color.calendar.weekend "
|
||||||
"confirmation curses data.location dateformat debug default.command default.priority "
|
"confirmation curses data.location dateformat debug default.command default.priority "
|
||||||
"default.project defaultwidth due locale displayweeknumber echo.command "
|
"default.project defaultwidth due locale displayweeknumber echo.command "
|
||||||
"locking monthsperline nag next project shadow.command shadow.file "
|
"locking monthsperline nag next project shadow.command shadow.file "
|
||||||
|
|
|
@ -1430,15 +1430,21 @@ std::string renderMonths (
|
||||||
|
|
||||||
table.addCell (row, thisCol, d);
|
table.addCell (row, thisCol, d);
|
||||||
|
|
||||||
Color color_today (context.config.get ("color.calendar.today", "cyan"));
|
Color color_today (context.config.get ("color.calendar.today", "black on cyan"));
|
||||||
Color color_due (context.config.get ("color.calendar.due", "black on yellow"));
|
Color color_due (context.config.get ("color.calendar.due", "black on green"));
|
||||||
Color color_overdue (context.config.get ("color.calendar.overdue", "black on red"));
|
Color color_overdue (context.config.get ("color.calendar.overdue", "black on red"));
|
||||||
|
Color color_weekend (context.config.get ("color.calendar.weekend", "black on white"));
|
||||||
|
|
||||||
if ((context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false)) &&
|
if (context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false))
|
||||||
today.day () == d &&
|
{
|
||||||
today.month () == months.at (mpl) &&
|
if (dow == 0 || dow == 6)
|
||||||
today.year () == years.at (mpl))
|
table.setCellColor (row, thisCol, color_weekend);
|
||||||
table.setCellColor (row, thisCol, color_today);
|
|
||||||
|
if (today.day () == d &&
|
||||||
|
today.month () == months.at (mpl) &&
|
||||||
|
today.year () == years.at (mpl))
|
||||||
|
table.setCellColor (row, thisCol, color_today);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (task, all)
|
foreach (task, all)
|
||||||
{
|
{
|
||||||
|
@ -1633,9 +1639,10 @@ int handleReportCalendar (std::string &outs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Color color_today (context.config.get ("color.calendar.today", "cyan"));
|
Color color_today (context.config.get ("color.calendar.today", "black on cyan"));
|
||||||
Color color_due (context.config.get ("color.calendar.due", "black on yellow"));
|
Color color_due (context.config.get ("color.calendar.due", "black on green"));
|
||||||
Color color_overdue (context.config.get ("color.calendar.overdue", "black on red"));
|
Color color_overdue (context.config.get ("color.calendar.overdue", "black on red"));
|
||||||
|
Color color_weekend (context.config.get ("color.calendar.weekend", "black on white"));
|
||||||
|
|
||||||
if (context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false))
|
if (context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false))
|
||||||
out << "Legend: "
|
out << "Legend: "
|
||||||
|
@ -1644,6 +1651,8 @@ int handleReportCalendar (std::string &outs)
|
||||||
<< color_due.colorize ("due")
|
<< color_due.colorize ("due")
|
||||||
<< ", "
|
<< ", "
|
||||||
<< color_overdue.colorize ("overdue")
|
<< color_overdue.colorize ("overdue")
|
||||||
|
<< ", "
|
||||||
|
<< color_weekend.colorize ("weekend")
|
||||||
<< "."
|
<< "."
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 58;
|
use Test::More tests => 60;
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'cal.rc')
|
if (open my $fh, '>', 'cal.rc')
|
||||||
|
@ -59,7 +59,7 @@ if ( $day <= 9)
|
||||||
|
|
||||||
# task cal and task cal y
|
# task cal and task cal y
|
||||||
my $output = qx{../task rc:cal.rc rc._forcecolor:on cal};
|
my $output = qx{../task rc:cal.rc rc._forcecolor:on cal};
|
||||||
like ($output, qr/\[36m$day/, 'Current day is highlighted');
|
like ($output, qr/\[30;46m$day/, 'Current day is highlighted');
|
||||||
like ($output, qr/$month\w+?\s+?$year/, 'Current month and year are displayed');
|
like ($output, qr/$month\w+?\s+?$year/, 'Current month and year are displayed');
|
||||||
$output = qx{../task rc:cal.rc add zero};
|
$output = qx{../task rc:cal.rc add zero};
|
||||||
unlike ($output, qr/\[41m\d+/, 'No overdue tasks are present');
|
unlike ($output, qr/\[41m\d+/, 'No overdue tasks are present');
|
||||||
|
@ -88,17 +88,19 @@ $output = qx{../task rc:cal.rc rc._forcecolor:on cal due};
|
||||||
unlike ($output, qr/April 2019/, 'April 2019 is not displayed');
|
unlike ($output, qr/April 2019/, 'April 2019 is not displayed');
|
||||||
like ($output, qr/May 2019/, 'May 2019 is displayed');
|
like ($output, qr/May 2019/, 'May 2019 is displayed');
|
||||||
unlike ($output, qr/January 2020/, 'January 2020 is not displayed');
|
unlike ($output, qr/January 2020/, 'January 2020 is not displayed');
|
||||||
like ($output, qr/43m15/, 'Task 1 is color-coded due');
|
like ($output, qr/30;42m15/, 'Task 1 is color-coded due');
|
||||||
$output = qx{../task rc:cal.rc rc._forcecolor:on cal due y};
|
$output = qx{../task rc:cal.rc rc._forcecolor:on cal due y};
|
||||||
like ($output, qr/43m23/, 'Task 2 is color-coded due');
|
like ($output, qr/30;42m23/, 'Task 2 is color-coded due');
|
||||||
like ($output, qr/April 2020/, 'April 2020 is displayed');
|
like ($output, qr/April 2020/, 'April 2020 is displayed');
|
||||||
unlike ($output, qr/May 2020/, 'May 2020 is not displayed');
|
unlike ($output, qr/May 2020/, 'May 2020 is not displayed');
|
||||||
qx{../task rc:cal.rc ls};
|
qx{../task rc:cal.rc ls};
|
||||||
qx{../task rc:cal.rc del 1-3};
|
qx{../task rc:cal.rc del 1-3};
|
||||||
qx{../task rc:cal.rc add due:20080408 three};
|
qx{../task rc:cal.rc add due:20080408 three};
|
||||||
$output = qx{../task rc:cal.rc rc._forcecolor:on cal due};
|
$output = qx{../task rc:cal.rc rc._forcecolor:on cal due};
|
||||||
like ($output, qr/April 2008/, 'April 2008 is displayed');
|
like ($output, qr/April 2008/, 'April 2008 is displayed');
|
||||||
like ($output, qr/41m 8/, 'Task 3 is color-coded overdue');
|
like ($output, qr/41m 8/, 'Task 3 is color-coded overdue');
|
||||||
|
like ($output, qr/30;47m19/, 'Saturday April 19, 2008 is color-coded');
|
||||||
|
like ($output, qr/30;47m20/, 'Sunday April 20, 2008 is color-coded');
|
||||||
|
|
||||||
# task cal 2016
|
# task cal 2016
|
||||||
$output = qx{../task rc:cal.rc rc.weekstart:Monday cal 2016};
|
$output = qx{../task rc:cal.rc rc.weekstart:Monday cal 2016};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue