aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2012-10-05 22:51:08 +0200
committerChristoph Lohmann <20h@r-36.net>2012-10-05 22:51:08 +0200
commit2549840ed7e69cddcc020533764ca12881026ffd (patch)
tree86b10e054fd8a0c1bab1c64ab2a1bc3d0302ff5c
parent0ddbb0c6ccd69e43a15808bdebd11fd350243248 (diff)
downloadst-2549840ed7e69cddcc020533764ca12881026ffd.tar.gz
st-2549840ed7e69cddcc020533764ca12881026ffd.tar.bz2
Fixing the brightening on bold. For the 256 colors and greyscale I assumed a
reasonable solution.
-rw-r--r--st.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/st.c b/st.c
index df166b7..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))