Reading colors from config; defaults now hex

This commit is contained in:
Bob Polis 2022-09-24 10:44:47 +02:00
parent 2d39870809
commit a4cd8232f1

View File

@ -3,6 +3,7 @@
#include <libscnumerics.hpp>
#include <vector>
#include <cmath>
#include <string>
// rectangles have width between 2 and 50 pixels
// rectangles have color black, white, or sand
@ -12,10 +13,10 @@
// screensize therefore determines grid, which should be centered
// after some time, a new random setup is chosen, and we animate to the new situation
const RGB black {0, 0, 0};
const RGB white {1, 1, 1};
const RGB sand {182.0 / 256.0, 144.0 / 256.0, 97.0 / 256.0};
const RGB pastel_green {177.0 / 256.0, 209.0 / 256.0, 175.0 / 256.0};
const std::string black {"#000000"};
const std::string white {"#FFFFFF"};
const std::string sand {"#B69061"};
const std::string pastel_green {"#B1D1AF"};
struct Rect {
double cx {0};
@ -103,6 +104,10 @@ void Grid::configure() {
_fade = _j["fade"];
_border = _j["border"];
_new.bg = Color {_j["bg"]};
_colors.clear();
for (const auto& hex : _j["colors"]) {
_colors.emplace_back(hex);
}
}
int Grid::fps() const {