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

@ -46,18 +46,14 @@ Palette::Palette ()
Color ("black on bright cyan"),
Color ("black on bright yellow"),
};
_current = 0;
}
////////////////////////////////////////////////////////////////////////////////
void Palette::initialize (const Rules& rules)
void Palette::add (Color c)
{
auto themeColors = rules.all ("theme.palette.color");
if (themeColors.size ())
{
_colors.clear ();
for (auto& entry : themeColors)
_colors.push_back (Color (rules.get (entry)));
}
_colors.push_back (c);
}
////////////////////////////////////////////////////////////////////////////////
@ -77,3 +73,10 @@ int Palette::size () const
}
////////////////////////////////////////////////////////////////////////////////
void Palette::clear ()
{
_colors.clear ();
_current = 0;
}
////////////////////////////////////////////////////////////////////////////////