csi: move 256-color table into the terminal struct

This commit is contained in:
Daniel Eklöf 2019-08-21 17:56:21 +02:00
parent 3efc30c6a1
commit d7aaeaedee
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 30 additions and 27 deletions

24
main.c
View file

@ -493,6 +493,30 @@ main(int argc, char *const *argv)
},
};
/* Initialize the 256 gray-scale color cube */
{
#if 0 /* pick colors from term struct instead, since they can be changed runtime */
for (size_t i = 0; i < 8; i++)
term.colors.default_colors256[i] = term.colors.default_regular[i];
for (size_t i = 0; i < 8; i++)
term.colors.default_colors256[8 + i] = term.colors.default_bright[i];
#endif
for (size_t r = 0; r < 6; r++) {
for (size_t g = 0; g < 6; g++) {
for (size_t b = 0; b < 6; b++) {
term.colors.default_colors256[16 + r * 6 * 6 + g * 6 + b]
= r * 51 << 16 | g * 51 << 8 | b * 51;
}
}
}
for (size_t i = 0; i < 24; i++)
term.colors.default_colors256[232 + i] = i * 11 << 16 | i * 11 << 8 | i * 11;
memcpy(term.colors.colors256, term.colors.default_colors256, sizeof(term.colors.colors256));
}
LOG_INFO("using %zu rendering threads", term.render.workers.count);
struct render_worker_context worker_context[term.render.workers.count];