#include #include "presets.hpp" namespace Gradients { #define GRADIENT(name, len, ...) \ constexpr Gradient name = { \ .n_colors = len, \ .colors = __VA_ARGS__, \ } GRADIENT(rainbow, 6, { Colors::red, Colors::orange, Colors::yellow, Colors::green, Colors::blue, Colors::purple, }); GRADIENT(peacock, 4, { Colors::teal, Colors::black, Colors::purple, Colors::blue, }); } // Gradients namespace Patterns { #define PATTERN(x) \ static const Pattern x = { \ .cycle_length = 20, \ .cycle_time_ms = 10000, \ .reverse = false, \ .march = false, \ .gradient = Gradients::x, \ } PATTERN(rainbow); PATTERN(peacock); } // Patterns #define PRESET(x) {#x, &Patterns::x} static const std::map presets = { PRESET(rainbow), PRESET(peacock), }; const Pattern* Presets::find(const std::string &name) { auto e = presets.find(name); return e == presets.end() ? NULL : e->second; }