Oops, it looks like I attached the wrong patch. The updated one should be attached to this email.
Regards, Raheman On Sun, Jan 10, 2021 at 4:09 PM Raheman Vaiya <[email protected]> wrote: > > > Why is the default theme changed to black fg, white bg instead of the > > default > > grey fg, black bg? This change seems unrelated. > > Sorry, this was an oversight. I have rectified in the attached patch. I also > used the wrong foreground escape sequence which I have adjusted. > > > Theres a similar patch on the wiki it seems: > > https://st.suckless.org/patches/osc_10_11_12/st-osc_10_11_12-20200418-66520e1.diff > > I was not aware of this patch, but it seems to keep defaultfg and > defaultbg set to > colours 0 and 7 which is non standard behaviour. It is possible for > the background > colour to be different from colour 0/7 in most other terminals. I think this > is > sufficiently standard behaviour to warrant being upstreamed rather than > applied > as a separate patch. > > On Sun, Jan 10, 2021 at 3:51 PM Hiltjo Posthuma <[email protected]> > wrote: > > > > On Sun, Jan 10, 2021 at 02:25:38PM -0500, Raheman Vaiya wrote: > > > The attached patch adds support for the OSC 11 and OSC 12 escape > > > sequences. These are used by many theme scripts (e.g > > > https://github.com/lemnos/theme.sh) and implemented by most other > > > terminal emulators. This is my first patch to a suckless project. Any > > > feedback would be appreciated :). > > > > > > > Hi, > > > > Some comments inline below. > > > > > Regards, > > > Raheman > > > > > From 07177328951a563a7407cb1921500791b92f37ec Mon Sep 17 00:00:00 2001 > > > From: Raheman Vaiya <[email protected]> > > > Date: Sun, 10 Jan 2021 02:49:50 -0500 > > > Subject: [PATCH] Implement OSC 11/12 for setting background and foreground > > > colours. > > > > > > --- > > > config.def.h | 7 +++++-- > > > st.c | 20 ++++++++++++++++++++ > > > 2 files changed, 25 insertions(+), 2 deletions(-) > > > > > > diff --git a/config.def.h b/config.def.h > > > index 6f05dce..fcdc6db 100644 > > > --- a/config.def.h > > > +++ b/config.def.h > > > @@ -120,6 +120,8 @@ static const char *colorname[] = { > > > /* more colors can be added after 255 to use with DefaultXX */ > > > "#cccccc", > > > "#555555", > > > + "#000000", > > > + "#ffffff", > > > }; > > > > > > > > > @@ -127,8 +129,9 @@ static const char *colorname[] = { > > > * Default colors (colorname index) > > > * foreground, background, cursor, reverse cursor > > > */ > > > -unsigned int defaultfg = 7; > > > -unsigned int defaultbg = 0; > > > + > > > +unsigned int defaultbg = 258; > > > +unsigned int defaultfg = 259; > > > static unsigned int defaultcs = 256; > > > static unsigned int defaultrcs = 257; > > > > > > > Why is the default theme changed to black fg, white bg instead of the > > default > > grey fg, black bg? This change seems unrelated. > > > > > diff --git a/st.c b/st.c > > > index abbbe4b..c0b8675 100644 > > > --- a/st.c > > > +++ b/st.c > > > @@ -1877,6 +1877,26 @@ strhandle(void) > > > } > > > } > > > return; > > > + case 11: /* set background color */ > > > + if (narg < 2) > > > + break; > > > + > > > + p = strescseq.args[1]; > > > + if (xsetcolorname(defaultbg, p)) > > > + fprintf(stderr, "erresc: invalid background > > > color %d\n", p); > > > + else > > > + redraw(); > > > + break; > > > + case 12: /* set foreground color */ > > > + if (narg < 2) > > > + break; > > > + > > > + p = strescseq.args[1]; > > > + if (xsetcolorname(defaultfg, p)) > > > + fprintf(stderr, "erresc: invalid foreground > > > color %d\n", p); > > > + else > > > + redraw(); > > > + break; > > > case 4: /* color set */ > > > if (narg < 3) > > > break; > > > -- > > > 2.20.1 > > > > > > > > > Theres a similar patch on the wiki it seems: > > https://st.suckless.org/patches/osc_10_11_12/st-osc_10_11_12-20200418-66520e1.diff > > > > -- > > Kind regards, > > Hiltjo > >
From 6632145bd3794cf977e5ecb1066817d1d4e5d3fc Mon Sep 17 00:00:00 2001 From: Raheman Vaiya <[email protected]> Date: Sun, 10 Jan 2021 02:49:50 -0500 Subject: [PATCH] Implement OSC 11/12 for setting background and foreground colours. --- config.def.h | 11 +++++++---- st.c | 30 ++++++++++++++++++++++++++++++ st.h | 1 + 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/config.def.h b/config.def.h index 6f05dce..746f075 100644 --- a/config.def.h +++ b/config.def.h @@ -5,7 +5,7 @@ * * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ -static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; +static char *font = "Liberation Mono:pixelsize=24:antialias=true:autohint=true"; static int borderpx = 2; /* @@ -120,6 +120,8 @@ static const char *colorname[] = { /* more colors can be added after 255 to use with DefaultXX */ "#cccccc", "#555555", + "black", + "gray90", }; @@ -127,9 +129,10 @@ static const char *colorname[] = { * Default colors (colorname index) * foreground, background, cursor, reverse cursor */ -unsigned int defaultfg = 7; -unsigned int defaultbg = 0; -static unsigned int defaultcs = 256; + +unsigned int defaultbg = 258; +unsigned int defaultfg = 259; +unsigned int defaultcs = 256; static unsigned int defaultrcs = 257; /* diff --git a/st.c b/st.c index abbbe4b..6a57d89 100644 --- a/st.c +++ b/st.c @@ -1877,6 +1877,36 @@ strhandle(void) } } return; + case 10: /* set foreground color */ + if (narg < 2) + break; + + p = strescseq.args[1]; + if (xsetcolorname(defaultfg, p)) + fprintf(stderr, "erresc: invalid foreground color %d\n", p); + else + redraw(); + break; + case 11: /* set background color */ + if (narg < 2) + break; + + p = strescseq.args[1]; + if (xsetcolorname(defaultbg, p)) + fprintf(stderr, "erresc: invalid background color %d\n", p); + else + redraw(); + break; + case 12: /* set cursor color */ + if (narg < 2) + break; + + p = strescseq.args[1]; + if (xsetcolorname(defaultcs, p)) + fprintf(stderr, "erresc: invalid cursor color %d\n", p); + else + redraw(); + break; case 4: /* color set */ if (narg < 3) break; diff --git a/st.h b/st.h index 3d351b6..054366d 100644 --- a/st.h +++ b/st.h @@ -123,3 +123,4 @@ extern char *termname; extern unsigned int tabspaces; extern unsigned int defaultfg; extern unsigned int defaultbg; +extern unsigned int defaultcs; -- 2.20.1
