mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Use internal fields color_today and color_holiday in getDayColor
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
9fcadaee1c
commit
b4a15b3c84
2 changed files with 6 additions and 8 deletions
|
@ -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 {};
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue