Use internal fields color_today and color_holiday in getDayColor

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2019-03-15 16:28:20 +01:00
parent 9fcadaee1c
commit b4a15b3c84
2 changed files with 6 additions and 8 deletions

View file

@ -131,7 +131,7 @@ std::string Chart::render (
} }
auto now = Datetime (); auto now = Datetime ();
auto color_day = getDayColor (day, now, holidays, color_today, color_holiday); auto color_day = getDayColor (day, now, holidays);
auto labelMonth = with_label_month ? renderMonth (previous, day) : ""; auto labelMonth = with_label_month ? renderMonth (previous, day) : "";
auto labelWeek = with_label_week ? renderWeek (previous, day) : ""; auto labelWeek = with_label_week ? renderWeek (previous, day) : "";
@ -326,24 +326,22 @@ std::string Chart::renderDay (Datetime &day, const Color &color)
Color Chart::getDayColor ( Color Chart::getDayColor (
const Datetime &day, const Datetime &day,
const Datetime &now, const Datetime &now,
const std::map<Datetime, std::string> &holidays, const std::map <Datetime, std::string> &holidays)
const Color &colorToday,
const Color &colorHoliday)
{ {
if (day.sameDay (now)) if (day.sameDay (now))
{ {
return colorToday; return color_today;
} }
for (auto &entry : holidays) for (auto &entry : holidays)
{ {
if (day.sameDay (entry.first)) if (day.sameDay (entry.first))
{ {
return colorHoliday; return color_holiday;
} }
} }
return Color{}; return Color {};
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -57,7 +57,7 @@ private:
std::pair <int, int> determineHourRange (const Interval&, const std::vector <Interval>&); std::pair <int, int> determineHourRange (const Interval&, const std::vector <Interval>&);
Color getDayColor (const Datetime&, const Datetime&, const std::map <Datetime, std::string>&, const Color&, const Color&); Color getDayColor (const Datetime &, const Datetime &, const std::map<Datetime, std::string> &);
const bool with_label_month; const bool with_label_month;
const bool with_label_week; const bool with_label_week;