JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Render faint attribute
authorAnders Eurenius <aes@spotify.com>
Sat, 21 Jun 2014 22:10:59 +0000 (00:10 +0200)
committerRoberto E. Vargas Caballero <k0ga@shike2.com>
Tue, 8 Jul 2014 20:46:55 +0000 (22:46 +0200)
Faint text is implemented by allocating a new color at one-half
intensity of each of the r, g, b components, or if the text bold at the
same time, it is not made lighter.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Signed-off-by: Christoph Lohmann <20h@r-36.net>

st.c

diff --git a/st.c b/st.c
index 61024c8..69ec122 100644 (file)
--- a/st.c
+++ b/st.c
@@ -3179,7 +3179,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
                 * change basic system colors [0-7]
                 * to bright system colors [8-15]
                 */
                 * change basic system colors [0-7]
                 * to bright system colors [8-15]
                 */
-               if(BETWEEN(base.fg, 0, 7))
+               if(BETWEEN(base.fg, 0, 7) && !(base.mode & ATTR_FAINT))
                        fg = &dc.col[base.fg + 8];
 
                if(base.mode & ATTR_ITALIC) {
                        fg = &dc.col[base.fg + 8];
 
                if(base.mode & ATTR_ITALIC) {
@@ -3223,6 +3223,14 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
                bg = temp;
        }
 
                bg = temp;
        }
 
+       if(base.mode & ATTR_FAINT && !(base.mode & ATTR_BOLD)) {
+               colfg.red = fg->color.red / 2;
+               colfg.green = fg->color.green / 2;
+               colfg.blue = fg->color.blue / 2;
+               XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colfg, &revfg);
+               fg = &revfg;
+       }
+
        if(base.mode & ATTR_BLINK && term.mode & MODE_BLINK)
                fg = bg;
 
        if(base.mode & ATTR_BLINK && term.mode & MODE_BLINK)
                fg = bg;