spmenu/libs/schemes.c

94 lines
2.5 KiB
C
Raw Normal View History

2023-05-14 00:21:16 +02:00
/* See LICENSE file for copyright and license details. */
2023-08-07 05:54:59 +02:00
#include "schemes.h"
char sixd_to_8bit(int x) {
2023-05-08 23:00:45 +02:00
return x == 0 ? 0 : 0x37 + 0x28 * x;
}
void init_appearance(void) {
2023-05-08 18:15:20 +02:00
int i = 0;
char cbuf[8];
2023-06-03 00:07:28 +02:00
if (!alpha && protocol) {
alpha_itemnormfg = 255;
alpha_itemnormbg = 255;
alpha_itemnormfg2 = 255;
alpha_itemnormbg2 = 255;
alpha_itemselfg = 255;
alpha_itemselbg = 255;
alpha_itemmarkedfg = 255;
alpha_itemmarkedbg = 255;
alpha_itemnormprifg = 255;
alpha_itemnormpribg = 255;
alpha_itemselprifg = 255;
alpha_itemselpribg = 255;
alpha_inputfg = 255;
alpha_inputbg = 255;
alpha_pretextfg = 255;
alpha_pretextbg = 255;
2023-06-03 00:07:28 +02:00
alpha_menu = 255;
alpha_promptfg = 255;
alpha_promptbg = 255;
alpha_larrowfg = 255;
alpha_larrowbg = 255;
alpha_rarrowfg = 255;
alpha_rarrowbg = 255;
alpha_hlnormfg = 255;
alpha_hlnormbg = 255;
alpha_hlselfg = 255;
alpha_hlselbg = 255;
alpha_numfg = 255;
alpha_numbg = 255;
alpha_border = 255;
alpha_caretfg = 255;
alpha_caretbg = 255;
alpha_modefg = 255;
alpha_modebg = 255;
alpha_capsfg = 255;
alpha_capsbg = 255;
}
for (i = 0; i < LENGTH(textcolors) && i < LENGTH(txtcols); i++) {
txtcols[i] = textcolors[i];
}
if (i == 0) {
txtcols[i] = "#000000";
}
2023-05-08 23:00:45 +02:00
for (; i < 7; i++) {
snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x",
!!(i & 1) * 0x7f,
!!(i & 2) * 0x7f,
!!(i & 4) * 0x7f);
txtcols[i] = cbuf;
}
if (i == 7) {
txtcols[i] = "#000000";
}
if (i == 8) {
txtcols[i] = "#333333";
2023-05-08 23:00:45 +02:00
}
for (; i < 16; i++) {
snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x",
!!(i & 1) * 0xff,
!!(i & 2) * 0xff,
!!(i & 4) * 0xff);
txtcols[i] = cbuf;
2023-05-08 23:00:45 +02:00
}
for (; i < 6 * 6 * 6 + 16; i++) {
snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x",
sixd_to_8bit(((i - 16) / 36) % 6),
sixd_to_8bit(((i - 16) / 6) % 6),
sixd_to_8bit(((i - 16)) % 6));
txtcols[i] = cbuf;
2023-05-08 23:00:45 +02:00
}
for (; i < 256; i++) {
snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x",
0x08 + (i - 6 * 6 * 6 - 16) * 0x0a,
0x08 + (i - 6 * 6 * 6 - 16) * 0x0a,
0x08 + (i - 6 * 6 * 6 - 16) * 0x0a);
txtcols[i] = cbuf;
2023-05-08 23:00:45 +02:00
}
}