commit 49b81c67cf225ed5bfb5bc6367b139889b5cf506
parent f050997d264f2ccee06ddd7d01dd56247a97cb25
Author: Hayden Hamilton <hayden@haydenvh.com>
Date: Tue, 14 Apr 2020 14:01:16 +0100
Removing dual palettes
Diffstat:
M | config.h | | | 33 | ++------------------------------- |
M | x.c | | | 73 | ++++++++++++++++--------------------------------------------------------- |
2 files changed, 18 insertions(+), 88 deletions(-)
diff --git a/config.h b/config.h
@@ -65,9 +65,6 @@ static int bellvolume = 100;
/* default TERM value */
char *termname = "st-256color";
-/* default pallete */
-unsigned int colorpalette = 0;
-
/*
* spaces per tab
*
@@ -85,8 +82,8 @@ unsigned int colorpalette = 0;
*/
unsigned int tabspaces = 8;
-/* Pallete 1 */
-static const char *colorname0[] = {
+/* Colors */
+static const char *colorname[] = {
/* Main pallete */
"#141726", // 1
"#24283c", // 2
@@ -112,31 +109,6 @@ static const char *colorname0[] = {
"#0a0a10", // 257
};
-/* Pallete 2 */
-static const char *colorname1[] = {
- /* Main pallete */
- "#626262", // 1
- "#676767", // 2
- "#6c6c6c", // 3
- "#717171", // 4
- "#757575", // 5
- "#797979", // 6
- "#7698a0", // 7
- "#7ca8ae", // 8
- "#6ea1a5", // 9
- "#84a8b6", // 10
- "#6f9eb8", // 11
- "#657d95", // 12
- "#c58764", // 13
- "#775c61", // 14
- "#a48473", // 15
- "#8ab2ad", // 16
- [255] = 0,
- /* More colours */
- "#3f6e88", // 256
- "#090909", // 257
-};
-
/*
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
@@ -216,7 +188,6 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_K, kscrollup, {.i = -1} },
{ TERMMOD, XK_J, kscrolldown, {.i = -1} },
{ TERMMOD, XK_Escape, keyboard_select,{.i = 0} },
- { TERMMOD, XK_C, switchpalette, {.i = 0} },
{ TERMMOD, XK_L, externalpipe, {.v = urlhand } },
};
diff --git a/x.c b/x.c
@@ -59,7 +59,6 @@ static void zoom(const Arg *);
static void zoomabs(const Arg *);
static void zoomreset(const Arg *);
static void ttysend(const Arg *);
-void switchpalette(void);
/* config.h for applying patches and the configuration. */
#include "config.h"
@@ -250,17 +249,6 @@ static char *opt_title = NULL;
static int oldbutton = 3; /* button event on startup: 3 = release */
void
-switchpalette(void)
-{
- if (colorpalette)
- colorpalette = 0;
- else
- colorpalette = 1;
-
- xinit(cols, rows);
-}
-
-void
clipcopy(const Arg *dummy)
{
Atom clipboard;
@@ -757,10 +745,8 @@ xloadcolor(int i, const char *name, Color *ncolor)
}
return XftColorAllocValue(xw.dpy, xw.vis,
xw.cmap, &color, ncolor);
- } else if (colorpalette)
- name = colorname1[i];
- else
- name = colorname0[i];
+ } else
+ name = colorname[i];
}
return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
@@ -776,27 +762,17 @@ xloadcols(void)
if (loaded) {
for (cp = dc.col; cp < &dc.col[dc.collen]; ++cp)
XftColorFree(xw.dpy, xw.vis, xw.cmap, cp);
- } else if (colorpalette) {
- dc.collen = MAX(LEN(colorname1), 256);
- dc.col = xmalloc(dc.collen * sizeof(Color));
} else {
- dc.collen = MAX(LEN(colorname0), 256);
+ dc.collen = MAX(LEN(colorname), 256);
dc.col = xmalloc(dc.collen * sizeof(Color));
}
for (i = 0; i < dc.collen; i++)
if (!xloadcolor(i, NULL, &dc.col[i])) {
- if (colorpalette) {
- if (colorname1[i])
- die("could not allocate color '%s'\n", colorname1[i]);
- else
- die("could not allocate color %d\n", i);
- } else {
- if (colorname0[i])
- die("could not allocate color '%s'\n", colorname0[i]);
- else
- die("could not allocate color %d\n", i);
- }
+ if (colorname[i])
+ die("could not allocate color '%s'\n", colorname[i]);
+ else
+ die("could not allocate color %d\n", i);
}
loaded = 1;
}
@@ -1153,30 +1129,16 @@ xinit(int cols, int rows)
cursor = XCreateFontCursor(xw.dpy, mouseshape);
XDefineCursor(xw.dpy, xw.win, cursor);
- if (colorpalette) {
- if (XParseColor(xw.dpy, xw.cmap, colorname1[mousefg], &xmousefg) == 0) {
- xmousefg.red = 0xffff;
- xmousefg.green = 0xffff;
- xmousefg.blue = 0xffff;
- }
-
- if (XParseColor(xw.dpy, xw.cmap, colorname1[mousebg], &xmousebg) == 0) {
- xmousebg.red = 0x0000;
- xmousebg.green = 0x0000;
- xmousebg.blue = 0x0000;
- }
- } else {
- if (XParseColor(xw.dpy, xw.cmap, colorname0[mousefg], &xmousefg) == 0) {
- xmousefg.red = 0xffff;
- xmousefg.green = 0xffff;
- xmousefg.blue = 0xffff;
- }
+ if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
+ xmousefg.red = 0xffff;
+ xmousefg.green = 0xffff;
+ xmousefg.blue = 0xffff;
+ }
- if (XParseColor(xw.dpy, xw.cmap, colorname0[mousebg], &xmousebg) == 0) {
- xmousebg.red = 0x0000;
- xmousebg.green = 0x0000;
- xmousebg.blue = 0x0000;
- }
+ if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
+ xmousebg.red = 0x0000;
+ xmousebg.green = 0x0000;
+ xmousebg.blue = 0x0000;
}
XRecolorCursor(xw.dpy, cursor, &xmousefg, &xmousebg);
@@ -2032,9 +1994,6 @@ main(int argc, char *argv[])
case 'v':
die("%s " VERSION "\n", argv0);
break;
- case 'p':
- colorpalette = atoi(EARGF(usage()));
- break;
default:
usage();
} ARGEND;