From 930c23021ede409d1d204769aae54ddbea7b0aaa Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 23 Apr 2016 00:04:55 -0400 Subject: [PATCH] Palette: Added support for color enable/disable --- src/Palette.cpp | 5 ++++- src/Palette.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Palette.cpp b/src/Palette.cpp index 7ea50de5..48b33829 100644 --- a/src/Palette.cpp +++ b/src/Palette.cpp @@ -60,7 +60,10 @@ void Palette::initialize (const Rules& rules) // Return the next color in the list. Cycle to the beginning if necessary. Color Palette::next () { - return _colors[_current++ % _colors.size ()]; + if (enabled) + return _colors[_current++ % _colors.size ()]; + + return Color (); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/Palette.h b/src/Palette.h index cb76943c..ba406ff7 100644 --- a/src/Palette.h +++ b/src/Palette.h @@ -40,6 +40,9 @@ public: Color next (); int size () const; +public: + bool enabled {true}; + private: std::vector _colors {}; int _current {0};