[st] fix: colors are legible now

This commit is contained in:
dogeystamp 2024-01-02 11:58:43 -05:00
parent 171c88a4fb
commit 5c16760c03
2 changed files with 16 additions and 14 deletions

View File

@ -122,15 +122,6 @@ static const char *colorname[] = {
"#b48ead", /* magenta */
"#8fbcbb", /* cyan */
"#eceff4", /* white */
[255] = 0,
/* more colors can be added after 255 to use with DefaultXX */
"#cccccc",
"#555555",
"gray90", /* default foreground colour */
"black", /* default background colour */
};
@ -138,10 +129,10 @@ static const char *colorname[] = {
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
*/
unsigned int defaultfg = 258;
unsigned int defaultbg = 259;
unsigned int defaultcs = 256;
static unsigned int defaultrcs = 257;
unsigned int defaultfg = 15;
unsigned int defaultbg = 0;
unsigned int defaultcs = 15;
static unsigned int defaultrcs = 0;
/*
* Default shape of cursor

View File

@ -1549,7 +1549,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
int winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch,
width = charlen * win.cw;
Color *fg, *bg, *temp, revfg, revbg, truefg, truebg;
Color *fg, *bg, *temp, revfg, revbg, clarfg, truefg, truebg;
XRenderColor colfg, colbg;
XRectangle r;
@ -1635,6 +1635,17 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
if (base.mode & ATTR_INVISIBLE)
fg = bg;
/* Hack that fixes fg becoming same as bg when its alpha is set near 0. */
if (fg == &dc.col[defaultbg]) {
colfg.red = fg->color.red;
colfg.green = fg->color.green;
colfg.blue = fg->color.blue;
colfg.alpha = 0xFFFF;
XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colfg,
&clarfg);
fg = &clarfg;
}
/* Intelligent cleaning up of the borders. */
if (x == 0) {
xclear(0, (y == 0)? 0 : winy, win.hborderpx,