Render faint attribute
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.
cheers
aes
From 1d820c2e5d94e12d6e012536995fd2aa895b3e20 Mon Sep 17 00:00:00 2001
From: Anders Eurenius <[email protected]>
Date: Sun, 22 Jun 2014 00:10:59 +0200
Subject: [PATCH 4/8] Render faint attribute
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.
---
st.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/st.c b/st.c
index dcbc4cb..40dcdf3 100644
--- a/st.c
+++ b/st.c
@@ -3189,7 +3189,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]
*/
- 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) {
@@ -3233,6 +3233,14 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
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;
--
2.0.0