helper: Added createPalette, and a Palette interface change

This commit is contained in:
Paul Beckingham 2016-04-25 21:10:09 -04:00
parent 6567639465
commit 21166a044f
6 changed files with 32 additions and 16 deletions

View file

@ -537,6 +537,22 @@ std::vector <Range> combineHolidaysAndExclusions (
return addRanges (range, results, exclusionRanges);
}
////////////////////////////////////////////////////////////////////////////////
Palette createPalette (const Rules& rules)
{
Palette p;
auto colors = rules.all ("theme.palette.color");
if (colors.size ())
{
p.clear ();
for (auto& c : colors)
p.add (Color (rules.get (c)));
}
p.enabled = rules.getBoolean ("color");
return p;
}
////////////////////////////////////////////////////////////////////////////////
// Extract the tags from a set of intervals, and using a rotating color palette,
// map unique tags to color.