Add option to specify alternating entry background/foreground colors

This commit is contained in:
Barbaross 2022-06-02 09:16:08 -04:00 committed by Jari Vetoniemi
parent 9a76681b2c
commit a8ef2457cb
4 changed files with 20 additions and 0 deletions

View File

@ -217,6 +217,8 @@ usage(FILE *out, const char *name)
" --fbf defines the feedback foreground color. (wx)\n"
" --sb defines the selected background color. (wx)\n"
" --sf defines the selected foreground color. (wx)\n"
" --ab defines the alternating background color. (wx)\n"
" --af defines the alternating foreground color. (wx)\n"
" --scb defines the scrollbar background color. (wx)\n"
" --scf defines the scrollbar foreground color. (wx)\n", out);
@ -286,6 +288,8 @@ do_getopt(struct client *client, int *argc, char **argv[])
{ "fbf", required_argument, 0, 0x111 },
{ "sb", required_argument, 0, 0x112 },
{ "sf", required_argument, 0, 0x113 },
{ "ab", required_argument, 0, 0x123 },
{ "af", required_argument, 0, 0x124 },
{ "scb", required_argument, 0, 0x114 },
{ "scf", required_argument, 0, 0x115 },
@ -424,6 +428,12 @@ do_getopt(struct client *client, int *argc, char **argv[])
case 0x113:
client->colors[BM_COLOR_SELECTED_FG] = optarg;
break;
case 0x123:
client->colors[BM_COLOR_ALTERNATE_BG] = optarg;
break;
case 0x124:
client->colors[BM_COLOR_ALTERNATE_FG] = optarg;
break;
case 0x114:
client->colors[BM_COLOR_SCROLLBAR_BG] = optarg;
break;

View File

@ -343,6 +343,8 @@ enum bm_color {
BM_COLOR_FEEDBACK_FG,
BM_COLOR_SELECTED_BG,
BM_COLOR_SELECTED_FG,
BM_COLOR_ALTERNATE_BG,
BM_COLOR_ALTERNATE_FG,
BM_COLOR_SCROLLBAR_BG,
BM_COLOR_SCROLLBAR_FG,
BM_COLOR_LAST

View File

@ -27,6 +27,8 @@ static const char *default_colors[BM_COLOR_LAST] = {
"#121212FF", // BM_COLOR_FEEDBACK_FG
"#121212FF", // BM_COLOR_SELECTED_BG
"#D81860FF", // BM_COLOR_SELECTED_FG
"#D81860FF", // BM_COLOR_ALTERNATE_BG
"#121212FF", // BM_COLOR_ALTERNATE_FG
"#121212FF", // BM_COLOR_SCROLLBAR_BG
"#D81860FF", // BM_COLOR_SCROLLBAR_FG
};

View File

@ -360,6 +360,9 @@ bm_cairo_paint(struct cairo *cairo, uint32_t width, uint32_t max_height, const s
} else if (bm_menu_item_is_selected(menu, items[i])) {
bm_cairo_color_from_menu_color(menu, BM_COLOR_SELECTED_FG, &paint.fg);
bm_cairo_color_from_menu_color(menu, BM_COLOR_SELECTED_BG, &paint.bg);
} else if (i % 2 == 1) {
bm_cairo_color_from_menu_color(menu, BM_COLOR_ALTERNATE_FG, &paint.fg);
bm_cairo_color_from_menu_color(menu, BM_COLOR_ALTERNATE_BG, &paint.bg);
} else {
bm_cairo_color_from_menu_color(menu, BM_COLOR_ITEM_FG, &paint.fg);
bm_cairo_color_from_menu_color(menu, BM_COLOR_ITEM_BG, &paint.bg);
@ -426,6 +429,9 @@ bm_cairo_paint(struct cairo *cairo, uint32_t width, uint32_t max_height, const s
} else if (bm_menu_item_is_selected(menu, items[i])) {
bm_cairo_color_from_menu_color(menu, BM_COLOR_SELECTED_FG, &paint.fg);
bm_cairo_color_from_menu_color(menu, BM_COLOR_SELECTED_BG, &paint.bg);
} else if (i % 2 == 1) {
bm_cairo_color_from_menu_color(menu, BM_COLOR_ALTERNATE_FG, &paint.fg);
bm_cairo_color_from_menu_color(menu, BM_COLOR_ALTERNATE_BG, &paint.bg);
} else {
bm_cairo_color_from_menu_color(menu, BM_COLOR_ITEM_FG, &paint.fg);
bm_cairo_color_from_menu_color(menu, BM_COLOR_ITEM_BG, &paint.bg);