|
- #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(dark_rainbow, 6, {
- Colors::dark_red,
- Colors::dark_orange,
- Colors::dark_yellow,
- Colors::dark_green,
- Colors::dark_blue,
- Colors::dark_purple,
- });
-
- GRADIENT(pale_rainbow, 6, {
- Colors::pale_red,
- Colors::pale_orange,
- Colors::pale_yellow,
- Colors::pale_green,
- Colors::pale_blue,
- Colors::pale_purple,
- });
-
- GRADIENT(peacock, 4, {
- Colors::teal,
- Colors::black,
- Colors::purple,
- Colors::blue,
- });
-
- // Guaranteed to be random. https://xkcd.com/221/
- GRADIENT(random, 20, {
- {223, 241, 107},
- Colors::black,
- {34, 170, 82},
- Colors::black,
- {98, 222, 224},
- Colors::black,
- {230, 114, 8},
- Colors::black,
- {226, 215, 213},
- Colors::black,
- {94, 187, 179},
- Colors::black,
- {76, 185, 214},
- Colors::black,
- {40, 115, 111},
- Colors::black,
- {230, 234, 120},
- Colors::black,
- {157, 128, 68},
- Colors::black,
- });
-
-
- } // 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(dark_rainbow);
- PATTERN(pale_rainbow);
- PATTERN(peacock);
-
- static const Pattern random = {
- .cycle_length = 20,
- .cycle_time_ms = 10000,
- .reverse = false,
- .march = true,
- .gradient = Gradients::random
- };
-
- } // Patterns
-
-
- namespace Presets {
-
- #define PRESET(x) {#x, &Patterns::x}
-
- const std::map <std::string, const Pattern*> map = {
- PRESET(rainbow),
- PRESET(dark_rainbow),
- PRESET(pale_rainbow),
- PRESET(peacock),
- PRESET(random),
- };
-
- const Pattern* find(const std::string &name) {
- auto e = map.find(name);
- return e == map.end() ? NULL : e->second;
- }
-
- } // Presets
|