From: NeilBrown Date: Sun, 3 Sep 2023 12:07:34 +0000 (+1000) Subject: menu: show action in a different colour X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=65535eaeeb1e507fac65d810d8a9838b2209b6c5;p=edlib.git menu: show action in a different colour To make sure the name and the action look different, use a different color (blue) for the action. Signed-off-by: NeilBrown --- diff --git a/lib-menu.c b/lib-menu.c index f9202bc5..03efa03b 100644 --- a/lib-menu.c +++ b/lib-menu.c @@ -54,7 +54,7 @@ DEF_CMD(menu_clear) DEF_CMD(menu_attr) { - if (ci->str && strcmp(ci->str, "BG") == 0) { + if (ci->str && strcmp(ci->str, "FG") == 0) { char *s = call_ret(str, "doc:get-attr", ci->home, 0, ci->mark, "disabled"); char *v = (s && *s) ? "fg:white-40" : "fg:black"; @@ -63,6 +63,15 @@ DEF_CMD(menu_attr) free(s); return 1; } + if (ci->str && strcmp(ci->str, "fg") == 0) { + char *s = call_ret(str, "doc:get-attr", ci->home, + 0, ci->mark, "disabled"); + char *v = (s && *s) ? "fg:blue+60" : "fg:blue"; + comm_call(ci->comm2, "cb", ci->focus, 0, ci->mark, + v, 0, NULL, ci->str); + free(s); + return 1; + } if (ci->str && strcmp(ci->str, "shortcut") == 0) { char *s = call_ret(str, "doc:get-attr", ci->home, 0, ci->mark, "action"); @@ -147,10 +156,10 @@ DEF_CMD(menu_attach) if (strchr(mmode, 'V')) /* show the 'action' - presumably a key name */ attr_set_str(&docp->attrs, "line-format", - "<%BG>%name%shortcut"); + "<%FG>%name <%fg>%shortcut"); else attr_set_str(&docp->attrs, "line-format", - "<%BG>%name"); + "<%FG>%name"); attr_set_str(&docp->attrs, "done-key", ci->str2 ?: "menu-done"); /* No borders, just a shaded background to make menu stand out */ attr_set_str(&docp->attrs, "borders", "");