X-Git-Url: https://git.xinqibao.xyz/st.git/blobdiff_plain/2752018e27420947a034d50f1ce165bbb76ae1a8..bf6cf05ba5211b35d7b10169624679428c5f4974:/st.c diff --git a/st.c b/st.c index b4dc591..7ae9d8c 100644 --- a/st.c +++ b/st.c @@ -2192,10 +2192,27 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { if(base.mode & ATTR_REVERSE) temp = fg, fg = bg, bg = temp; + if(base.mode & ATTR_BOLD) { - fg = &dc.xft_col[base.fg + 8]; + if(BETWEEN(base.fg, 0, 7)) { + /* basic system colors */ + fg = &dc.xft_col[base.fg + 8]; + } else if(BETWEEN(base.fg, 16, 195)) { + /* 256 colors */ + fg = &dc.xft_col[base.fg + 36]; + } else if(BETWEEN(base.fg, 232, 251)) { + /* greyscale */ + fg = &dc.xft_col[base.fg + 4]; + } + /* + * Those ranges will not be brightened: + * 8 - 15 – bright system colors + * 196 - 231 – highest 256 color cube + * 252 - 255 – brightest colors in grescale + */ font = &dc.bfont; } + if(base.mode & ATTR_ITALIC) font = &dc.ifont; if(base.mode & (ATTR_ITALIC|ATTR_ITALIC)) @@ -2234,7 +2251,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { winy + font->ascent, (FcChar8 *)s, bytelen); if(base.mode & ATTR_UNDERLINE) { - XftDrawRect(xw.xft_draw, fg, winx, winy+1, + XftDrawRect(xw.xft_draw, fg, winx, winy + font->ascent + 1, width, 1); } }