Added color blending to cal report

This commit is contained in:
Federico Hernandez 2010-02-12 01:15:19 +01:00
parent 4adfec4482
commit e80769794e

View file

@ -1512,10 +1512,11 @@ std::string renderMonths (
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor")) if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
{ {
Color cellColor;
// colorize weekends // colorize weekends
if (dow == 0 || dow == 6) if (dow == 0 || dow == 6)
table.setCellColor (row, thisCol, color_weekend); cellColor.blend (color_weekend);
// colorize holidays // colorize holidays
if (context.config.get ("calendar.holidays") != "none") if (context.config.get ("calendar.holidays") != "none")
@ -1531,7 +1532,7 @@ std::string renderMonths (
if (holDate.day () == d && if (holDate.day () == d &&
holDate.month () == months[mpl] && holDate.month () == months[mpl] &&
holDate.year () == years[mpl]) holDate.year () == years[mpl])
table.setCellColor (row, thisCol, color_holiday); cellColor.blend (color_holiday);
} }
} }
@ -1539,7 +1540,7 @@ std::string renderMonths (
if (today.day () == d && if (today.day () == d &&
today.month () == months.at (mpl) && today.month () == months.at (mpl) &&
today.year () == years.at (mpl)) today.year () == years.at (mpl))
table.setCellColor (row, thisCol, color_today); cellColor.blend (color_today);
// colorize due tasks // colorize due tasks
if (context.config.get ("calendar.details") != "none") if (context.config.get ("calendar.details") != "none")
@ -1547,8 +1548,6 @@ std::string renderMonths (
context.config.set ("due", 0); context.config.set ("due", 0);
foreach (task, all) foreach (task, all)
{ {
if (task->getStatus () == Task::pending && if (task->getStatus () == Task::pending &&
task->has ("due")) task->has ("due"))
{ {
@ -1562,15 +1561,15 @@ std::string renderMonths (
switch (getDueState (due)) switch (getDueState (due))
{ {
case 1: // imminent case 1: // imminent
table.setCellColor (row, thisCol, color_due); cellColor.blend (color_due);
break; break;
case 2: // today case 2: // today
table.setCellColor (row, thisCol, color_duetoday); cellColor.blend (color_duetoday);
break; break;
case 3: // overdue case 3: // overdue
table.setCellColor (row, thisCol, color_overdue); cellColor.blend (color_overdue);
break; break;
case 0: // not due at all case 0: // not due at all
@ -1581,6 +1580,7 @@ std::string renderMonths (
} }
} }
} }
table.setCellColor (row, thisCol, cellColor);
} }
// Check for end of week, and... // Check for end of week, and...