[st][PATCH] OSC 10/11/12 fg, bg and cursor colors
Support for OSC escape sequences 10, 11 and 12 to modify the bg, fg and cursor colors. I selected entries in the colorname table after the 255 position for defaultfg, defaultbg and defaultcs
This commit is contained in:
parent
24c9ea1e51
commit
bda5b50b99
3 changed files with 17 additions and 5 deletions
17
st.c
17
st.c
|
|
@ -2009,12 +2009,23 @@ strhandle(void)
|
|||
}
|
||||
return;
|
||||
case 4: /* color set */
|
||||
if (narg < 3)
|
||||
case 10: /* foreground set */
|
||||
case 11: /* background set */
|
||||
case 12: /* cursor color */
|
||||
if ((par == 4 && narg < 3) || narg < 2)
|
||||
break;
|
||||
p = strescseq.args[2];
|
||||
p = strescseq.args[((par == 4) ? 2 : 1)];
|
||||
/* FALLTHROUGH */
|
||||
case 104: /* color reset, here p = NULL */
|
||||
j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
|
||||
if (par == 10)
|
||||
j = defaultfg;
|
||||
else if (par == 11)
|
||||
j = defaultbg;
|
||||
else if (par == 12)
|
||||
j = defaultcs;
|
||||
else
|
||||
j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
|
||||
|
||||
if (xsetcolorname(j, p)) {
|
||||
if (par == 104 && narg <= 1)
|
||||
return; /* color reset without parameter */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue