#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 namespace Presets { #define PRESET(x) {#x, &Patterns::x} const std::map map = { PRESET(rainbow), PRESET(peacock), }; const Pattern* find(const std::string &name) { auto e = map.find(name); return e == map.end() ? NULL : e->second; } } // Presets