commit ae918b5129a73999a3fb06cb5a5b418b051acda1
parent 26ddbe6036c6f8f25deba5c8d428c6169e9d90cf
Author: Sarthak Shah <shahsarthakw@gmail.com>
Date: Tue, 12 Jan 2021 03:55:14 +0530
A patch that adds an alpha gradient effect to st. Requires the alpha patch
Diffstat:
2 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/st.suckless.org/patches/gradient/index.md b/st.suckless.org/patches/gradient/index.md
@@ -0,0 +1,22 @@
+Gradient
+====
+
+Description
+----
+This patch adds an alpha gradient to st.
+
+-----
+1. It requires the alpha patch, i.e. apply it before applying this
+2. Apply the patch to st's source code, and replace config.h with config.def.h before building the source
+3. To customize, change the variables 'grad_alpha' and 'stat_alpha' in config.def.h
+Maximum alpha value: minimum of grad_alpha + stat_alpha and 1
+Minimum alpha value: minimum of stat_alpha and grad_alpha - 1
+4. It is possible to invert the gradient by uncommenting the invert gradient code in x.c
+
+Download
+----
+* [st-gradient-0.8.4.diff](st-gradient-0.8.4.diff)
+
+Author
+----
+* Sarthak Shah : shahsarthakw at gmail.com
diff --git a/st.suckless.org/patches/gradient/st-gradient-0.8.4.diff b/st.suckless.org/patches/gradient/st-gradient-0.8.4.diff
@@ -0,0 +1,28 @@
+diff -up st/config.def.h st-gradient/config.def.h
+--- st/config.def.h 2021-01-12 03:24:27.313995808 +0530
++++ st-gradient/config.def.h 2021-01-12 03:03:37.837696991 +0530
+@@ -95,6 +95,8 @@ unsigned int tabspaces = 8;
+
+ /* bg opacity */
+ float alpha = 0.8;
++float grad_alpha = 0.54; //alpha value that'll change
++float stat_alpha = 0.46; //constant alpha value that'll get added to grad_alpha
+
+ /* Terminal colors (16 first used in escape sequence) */
+ static const char *colorname[] = {
+Common subdirectories: st/.git and st-gradient/.git
+diff -up st/x.c st-gradient/x.c
+--- st/x.c 2021-01-12 03:24:27.313995808 +0530
++++ st-gradient/x.c 2021-01-12 03:08:40.850694072 +0530
+@@ -1448,6 +1448,11 @@ xdrawglyphfontspecs(const XftGlyphFontSp
+
+ if (base.mode & ATTR_INVISIBLE)
+ fg = bg;
++
++ // gradient
++ bg->color.alpha = grad_alpha * 0xffff * (win.h - y*win.ch) / win.h + stat_alpha * 0xffff;
++ // uncomment to invert the gradient
++ // bg->color.alpha = grad_alpha * 0xffff * (y*win.ch) / win.h + stat_alpha * 0xffff;
+
+ /* Intelligent cleaning up of the borders. */
+ if (x == 0) {