[wiki] [sites] port no_bold_colors and solarized-both to 0.8.1 || Linh Nguyen

From: <git_AT_suckless.org>
Date: Wed, 28 Mar 2018 18:09:45 +0200

commit 32f32a90a8a9c6190a9843133039441abf7e6320
Author: Linh Nguyen <linhvng.2212_AT_gmail.com>
Date: Wed Mar 28 12:27:34 2018 -0400

    port no_bold_colors and solarized-both to 0.8.1

diff --git a/st.suckless.org/patches/solarized/index.md b/st.suckless.org/patches/solarized/index.md
index 4cd959af..5fe0028f 100644
--- a/st.suckless.org/patches/solarized/index.md
+++ b/st.suckless.org/patches/solarized/index.md
_AT_@ -35,6 +35,7 @@ to disable lighting up bold colors.
  * [st-no_bold_colors-0.5.diff](st-no_bold_colors-0.5.diff)
  * [st-no_bold_colors-0.6.diff](st-no_bold_colors-0.6.diff)
  * [st-no_bold_colors-0.7.diff](st-no_bold_colors-0.7.diff)
+ * [st-no_bold_colors-0.8.1.diff](st-no_bold_colors-0.8.1.diff)
  * [st-no_bold_colors-20170623-b331da5.diff](st-no_bold_colors-20170623-b331da5.diff)
 
 Choose one of the following patches to get either the light
_AT_@ -56,6 +57,7 @@ or the dark color scheme:
 
 *Both (swap between light/dark with F6)*:
 
+ * [st-solarized-both-0.8.1.diff](st-solarized-both-0.8.1.diff)
  * [st-solarized-both-20170626-b331da5.diff](st-solarized-both-20170626-b331da5.diff)
 
 
_AT_@ -67,3 +69,4 @@ Authors
  * Marcel Krüger - <zauguin_AT_gmail.com> (older git ports)
  * Harry Gindi - <harry.gindi_AT_live.com> (git ports for light, dark, and swap versions)
  * Matthew Parnell - <matt_AT_parnmatt.co.uk> (0.7 port)
+ * Linh Nguyen - <linhvng.2212_AT_gmail.com> (0.8.1 port for no_bold_colors and swap versions)
diff --git a/st.suckless.org/patches/solarized/st-no_bold_colors-0.8.1.diff b/st.suckless.org/patches/solarized/st-no_bold_colors-0.8.1.diff
new file mode 100644
index 00000000..1bd4657e
--- /dev/null
+++ b/st.suckless.org/patches/solarized/st-no_bold_colors-0.8.1.diff
_AT_@ -0,0 +1,25 @@
+From e0a92b498278e42e33f8007fd7b622a05e5310eb Mon Sep 17 00:00:00 2001
+From: Linh Nguyen <linhvng.2212_AT_gmail.com>
+Date: Wed, 28 Mar 2018 12:23:45 -0400
+Subject: [PATCH] port st-no_bold_colors patch to 0.8.1
+
+---
+ x.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/x.c b/x.c
+index c343ba2..42e7e9f 100644
+--- a/x.c
++++ b/x.c
+_AT_@ -1295,7 +1295,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
+
+ /* Change basic system colors [0-7] to bright system colors [8-15] */
+ if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7))
+- fg = &dc.col[base.fg + 8];
++ fg = &dc.col[base.fg];
+
+ if (IS_SET(MODE_REVERSE)) {
+ if (fg == &dc.col[defaultfg]) {
+--
+2.16.3
+
diff --git a/st.suckless.org/patches/solarized/st-solarized-both-0.8.1.diff b/st.suckless.org/patches/solarized/st-solarized-both-0.8.1.diff
new file mode 100644
index 00000000..6310f3bf
--- /dev/null
+++ b/st.suckless.org/patches/solarized/st-solarized-both-0.8.1.diff
_AT_@ -0,0 +1,216 @@
+From 79a5f9a3f4a606db1aa1b591aa38d74e331e354a Mon Sep 17 00:00:00 2001
+From: Linh Nguyen <linhvng.2212_AT_gmail.com>
+Date: Wed, 28 Mar 2018 11:46:26 -0400
+Subject: [PATCH] port st-solarized-both to 0.8.1
+
+---
+ config.def.h | 72 ++++++++++++++++++++++++++++++++++++------------------------
+ st.h | 1 +
+ x.c | 28 ++++++++++++++++++-----
+ 3 files changed, 66 insertions(+), 35 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 82b1b09..256662a 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -84,31 +84,44 @@ unsigned int tabspaces = 8;
+
+ /* Terminal colors (16 first used in escape sequence) */
+ static const char *colorname[] = {
+- /* 8 normal colors */
+- "black",
+- "red3",
+- "green3",
+- "yellow3",
+- "blue2",
+- "magenta3",
+- "cyan3",
+- "gray90",
+-
+- /* 8 bright colors */
+- "gray50",
+- "red",
+- "green",
+- "yellow",
+- "#5c5cff",
+- "magenta",
+- "cyan",
+- "white",
+-
+- [255] = 0,
+-
+- /* more colors can be added after 255 to use with DefaultXX */
+- "#cccccc",
+- "#555555",
++ /* solarized dark */
++ "#073642", /* 0: black */
++ "#dc322f", /* 1: red */
++ "#859900", /* 2: green */
++ "#b58900", /* 3: yellow */
++ "#268bd2", /* 4: blue */
++ "#d33682", /* 5: magenta */
++ "#2aa198", /* 6: cyan */
++ "#eee8d5", /* 7: white */
++ "#002b36", /* 8: brblack */
++ "#cb4b16", /* 9: brred */
++ "#586e75", /* 10: brgreen */
++ "#657b83", /* 11: bryellow */
++ "#839496", /* 12: brblue */
++ "#6c71c4", /* 13: brmagenta*/
++ "#93a1a1", /* 14: brcyan */
++ "#fdf6e3", /* 15: brwhite */
++};
++
++/* Terminal colors for alternate (light) palette */
++static const char *altcolorname[] = {
++ /* solarized light */
++ "#eee8d5", /* 0: black */
++ "#dc322f", /* 1: red */
++ "#859900", /* 2: green */
++ "#b58900", /* 3: yellow */
++ "#268bd2", /* 4: blue */
++ "#d33682", /* 5: magenta */
++ "#2aa198", /* 6: cyan */
++ "#073642", /* 7: white */
++ "#fdf6e3", /* 8: brblack */
++ "#cb4b16", /* 9: brred */
++ "#93a1a1", /* 10: brgreen */
++ "#839496", /* 11: bryellow */
++ "#657b83", /* 12: brblue */
++ "#6c71c4", /* 13: brmagenta*/
++ "#586e75", /* 14: brcyan */
++ "#002b36", /* 15: brwhite */
+ };
+
+
+_AT_@ -116,10 +129,10 @@ static const char *colorname[] = {
+ * Default colors (colorname index)
+ * foreground, background, cursor, reverse cursor
+ */
+-unsigned int defaultfg = 7;
+-unsigned int defaultbg = 0;
+-static unsigned int defaultcs = 256;
+-static unsigned int defaultrcs = 257;
++unsigned int defaultfg = 12;
++unsigned int defaultbg = 8;
++static unsigned int defaultcs = 14;
++static unsigned int defaultrcs = 15;
+
+ /*
+ * Default shape of cursor
+_AT_@ -178,6 +191,7 @@ static Shortcut shortcuts[] = {
+ { TERMMOD, XK_Y, selpaste, {.i = 0} },
+ { TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
+ { TERMMOD, XK_I, iso14755, {.i = 0} },
++ { XK_ANY_MOD, XK_F6, swapcolors, {.i = 0} },
+ };
+
+ /*
+diff --git a/st.h b/st.h
+index dac64d8..7b0159d 100644
+--- a/st.h
++++ b/st.h
+_AT_@ -118,6 +118,7 @@ extern char *vtiden;
+ extern char *worddelimiters;
+ extern int allowaltscreen;
+ extern char *termname;
++extern int usealtcolors;
+ extern unsigned int tabspaces;
+ extern unsigned int defaultfg;
+ extern unsigned int defaultbg;
+diff --git a/x.c b/x.c
+index c343ba2..47ef3e9 100644
+--- a/x.c
++++ b/x.c
+_AT_@ -53,6 +53,7 @@ static void clipcopy(const Arg *);
+ static void clippaste(const Arg *);
+ static void numlock(const Arg *);
+ static void selpaste(const Arg *);
++static void swapcolors(const Arg *);
+ static void zoom(const Arg *);
+ static void zoomabs(const Arg *);
+ static void zoomreset(const Arg *);
+_AT_@ -240,6 +241,8 @@ static char *opt_title = NULL;
+
+ static int oldbutton = 3; /* button event on startup: 3 = release */
+
++int usealtcolors = 0; /* 1 to use alternate palette */
++
+ void
+ clipcopy(const Arg *dummy)
+ {
+_AT_@ -278,6 +281,14 @@ numlock(const Arg *dummy)
+ win.mode ^= MODE_NUMLOCK;
+ }
+
++void
++swapcolors(const Arg *dummy)
++{
++ usealtcolors = !usealtcolors;
++ xloadcols();
++ redraw();
++}
++
+ void
+ zoom(const Arg *arg)
+ {
+_AT_@ -700,6 +711,11 @@ sixd_to_16bit(int x)
+ return x == 0 ? 0 : 0x3737 + 0x2828 * x;
+ }
+
++const char* getcolorname(int i)
++{
++ return (usealtcolors) ? altcolorname[i] : colorname[i];
++}
++
+ int
+ xloadcolor(int i, const char *name, Color *ncolor)
+ {
+_AT_@ -718,7 +734,7 @@ xloadcolor(int i, const char *name, Color *ncolor)
+ return XftColorAllocValue(xw.dpy, xw.vis,
+ xw.cmap, &color, ncolor);
+ } else
+- name = colorname[i];
++ name = getcolorname(i);
+ }
+
+ return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
+_AT_@ -731,7 +747,7 @@ xloadcols(void)
+ static int loaded;
+ Color *cp;
+
+- dc.collen = MAX(LEN(colorname), 256);
++ dc.collen = MAX(LEN(colorname), LEN(altcolorname));
+ dc.col = xmalloc(dc.collen * sizeof(Color));
+
+ if (loaded) {
+_AT_@ -741,8 +757,8 @@ xloadcols(void)
+
+ for (i = 0; i < dc.collen; i++)
+ if (!xloadcolor(i, NULL, &dc.col[i])) {
+- if (colorname[i])
+- die("Could not allocate color '%s'
", colorname[i]);
++ if (getcolorname(i))
++ die("Could not allocate color '%s'
", getcolorname(i));
+ else
+ die("Could not allocate color %d
", i);
+ }
+_AT_@ -1079,13 +1095,13 @@ xinit(int cols, int rows)
+ cursor = XCreateFontCursor(xw.dpy, mouseshape);
+ XDefineCursor(xw.dpy, xw.win, cursor);
+
+- if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
++ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousefg), &xmousefg) == 0) {
+ xmousefg.red = 0xffff;
+ xmousefg.green = 0xffff;
+ xmousefg.blue = 0xffff;
+ }
+
+- if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
++ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousebg), &xmousebg) == 0) {
+ xmousebg.red = 0x0000;
+ xmousebg.green = 0x0000;
+ xmousebg.blue = 0x0000;
+--
+2.16.3
+
Received on Wed Mar 28 2018 - 18:09:45 CEST

This archive was generated by hypermail 2.3.0 : Wed Mar 28 2018 - 18:12:22 CEST