logo

etc_portage

Unnamed repository; edit this file 'description' to name the repository. git clone https://hacktivis.me/git/etc_portage.git

0005-apply-st-gruvbox-both-0.8.1.diff.patch (5429B)


  1. From a5f5407bbcaa7d232af0e43bcacaac39d9b871ea Mon Sep 17 00:00:00 2001
  2. From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
  3. Date: Tue, 23 Oct 2018 02:39:08 +0200
  4. Subject: [PATCH 5/5] apply st-gruvbox-both-0.8.1.diff
  5. ---
  6. config.def.h | 68 +++++++++++++++++++++++++++++++++-------------------
  7. st.h | 1 +
  8. x.c | 28 +++++++++++++++++-----
  9. 3 files changed, 66 insertions(+), 31 deletions(-)
  10. diff --git a/config.def.h b/config.def.h
  11. index 78ebbc5..5f9a078 100644
  12. --- a/config.def.h
  13. +++ b/config.def.h
  14. @@ -84,31 +84,48 @@ unsigned int tabspaces = 8;
  15. /* Terminal colors (16 first used in escape sequence) */
  16. static const char *colorname[] = {
  17. - /* 8 normal colors */
  18. - "black",
  19. - "red3",
  20. - "green3",
  21. - "yellow3",
  22. - "blue2",
  23. - "magenta3",
  24. - "cyan3",
  25. - "gray90",
  26. -
  27. - /* 8 bright colors */
  28. - "gray50",
  29. - "red",
  30. - "green",
  31. - "yellow",
  32. - "#5c5cff",
  33. - "magenta",
  34. - "cyan",
  35. - "white",
  36. + /* gruvbox dark */
  37. + "#282828", /* hard contrast: #1d2021 / soft contrast: #32302f / normal: #282828 */
  38. + "#cc241d",
  39. + "#98971a",
  40. + "#d79921",
  41. + "#458588",
  42. + "#b16286",
  43. + "#689d6a",
  44. + "#a89984",
  45. + "#928374",
  46. + "#fb4934",
  47. + "#b8bb26",
  48. + "#fabd2f",
  49. + "#83a598",
  50. + "#d3869b",
  51. + "#8ec07c",
  52. + "#ebdbb2",
  53. [255] = 0,
  54. +};
  55. - /* more colors can be added after 255 to use with DefaultXX */
  56. - "#cccccc",
  57. - "#555555",
  58. +/* Terminal colors for alternate (light) palette */
  59. +static const char *altcolorname[] = {
  60. + /* gruvbox light */
  61. + "#fbf1c7", /* hard contrast: #f9f5d7 / soft contrast: #f2e5bc / normal: #fbf1c7 */
  62. + "#cc241d",
  63. + "#98971a",
  64. + "#d79921",
  65. + "#458588",
  66. + "#b16286",
  67. + "#689d6a",
  68. + "#7c6f64",
  69. + "#928374",
  70. + "#9d0006",
  71. + "#79740e",
  72. + "#b57614",
  73. + "#076678",
  74. + "#8f3f71",
  75. + "#427b58",
  76. + "#3c3836",
  77. +
  78. + [255] = 0,
  79. };
  80. @@ -116,10 +133,10 @@ static const char *colorname[] = {
  81. * Default colors (colorname index)
  82. * foreground, background, cursor, reverse cursor
  83. */
  84. -unsigned int defaultfg = 7;
  85. +unsigned int defaultfg = 15;
  86. unsigned int defaultbg = 0;
  87. -static unsigned int defaultcs = 256;
  88. -static unsigned int defaultrcs = 257;
  89. +static unsigned int defaultcs = 15;
  90. +static unsigned int defaultrcs = 0;
  91. /*
  92. * Default shape of cursor
  93. @@ -178,6 +195,7 @@ static Shortcut shortcuts[] = {
  94. { TERMMOD, XK_Y, selpaste, {.i = 0} },
  95. { ShiftMask, XK_Insert, selpaste, {.i = 0} },
  96. { TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
  97. + { TERMMOD, XK_F6, swapcolors, {.i = 0} },
  98. };
  99. /*
  100. diff --git a/st.h b/st.h
  101. index 38c61c4..941b5f8 100644
  102. --- a/st.h
  103. +++ b/st.h
  104. @@ -117,6 +117,7 @@ extern char *vtiden;
  105. extern char *worddelimiters;
  106. extern int allowaltscreen;
  107. extern char *termname;
  108. +extern int usealtcolors;
  109. extern unsigned int tabspaces;
  110. extern unsigned int defaultfg;
  111. extern unsigned int defaultbg;
  112. diff --git a/x.c b/x.c
  113. index 2cd76d0..5a54960 100644
  114. --- a/x.c
  115. +++ b/x.c
  116. @@ -53,6 +53,7 @@ static void clipcopy(const Arg *);
  117. static void clippaste(const Arg *);
  118. static void numlock(const Arg *);
  119. static void selpaste(const Arg *);
  120. +static void swapcolors(const Arg *);
  121. static void zoom(const Arg *);
  122. static void zoomabs(const Arg *);
  123. static void zoomreset(const Arg *);
  124. @@ -244,6 +245,8 @@ static char *opt_title = NULL;
  125. static int oldbutton = 3; /* button event on startup: 3 = release */
  126. +int usealtcolors = 0; /* 1 to use alternate palette */
  127. +
  128. void
  129. clipcopy(const Arg *dummy)
  130. {
  131. @@ -282,6 +285,14 @@ numlock(const Arg *dummy)
  132. win.mode ^= MODE_NUMLOCK;
  133. }
  134. +void
  135. +swapcolors(const Arg *dummy)
  136. +{
  137. + usealtcolors = !usealtcolors;
  138. + xloadcols();
  139. + redraw();
  140. +}
  141. +
  142. void
  143. zoom(const Arg *arg)
  144. {
  145. @@ -706,6 +717,11 @@ sixd_to_16bit(int x)
  146. return x == 0 ? 0 : 0x3737 + 0x2828 * x;
  147. }
  148. +const char* getcolorname(int i)
  149. +{
  150. + return (usealtcolors) ? altcolorname[i] : colorname[i];
  151. +}
  152. +
  153. int
  154. xloadcolor(int i, const char *name, Color *ncolor)
  155. {
  156. @@ -724,7 +740,7 @@ xloadcolor(int i, const char *name, Color *ncolor)
  157. return XftColorAllocValue(xw.dpy, xw.vis,
  158. xw.cmap, &color, ncolor);
  159. } else
  160. - name = colorname[i];
  161. + name = getcolorname(i);
  162. }
  163. return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
  164. @@ -741,14 +757,14 @@ xloadcols(void)
  165. for (cp = dc.col; cp < &dc.col[dc.collen]; ++cp)
  166. XftColorFree(xw.dpy, xw.vis, xw.cmap, cp);
  167. } else {
  168. - dc.collen = MAX(LEN(colorname), 256);
  169. + dc.collen = MAX(LEN(colorname), LEN(altcolorname));
  170. dc.col = xmalloc(dc.collen * sizeof(Color));
  171. }
  172. for (i = 0; i < dc.collen; i++)
  173. if (!xloadcolor(i, NULL, &dc.col[i])) {
  174. - if (colorname[i])
  175. - die("could not allocate color '%s'\n", colorname[i]);
  176. + if (getcolorname(i))
  177. + die("could not allocate color '%s'\n", getcolorname(i));
  178. else
  179. die("could not allocate color %d\n", i);
  180. }
  181. @@ -1108,13 +1124,13 @@ xinit(int cols, int rows)
  182. cursor = XCreateFontCursor(xw.dpy, mouseshape);
  183. XDefineCursor(xw.dpy, xw.win, cursor);
  184. - if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
  185. + if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousefg), &xmousefg) == 0) {
  186. xmousefg.red = 0xffff;
  187. xmousefg.green = 0xffff;
  188. xmousefg.blue = 0xffff;
  189. }
  190. - if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
  191. + if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousebg), &xmousebg) == 0) {
  192. xmousebg.red = 0x0000;
  193. xmousebg.green = 0x0000;
  194. xmousebg.blue = 0x0000;
  195. --
  196. 2.21.0