Added solarized patches

master
Toerd@iArch 6 years ago
parent dedbe8341e
commit 127781f192

@ -85,35 +85,51 @@ unsigned int tabspaces = 8;
/* bg opacity */
unsigned int alpha = 0xee;
static const char *colorname[] = {
/* 8 normal colors */
[0] = "#282c34", /* black */
[1] = "#e06c75", /* red */
[2] = "#98c379", /* green */
[3] = "#e5c07b", /* yellow */
[4] = "#61afef", /* blue */
[5] = "#c678dd", /* magenta */
[6] = "#56b6c2", /* cyan */
[7] = "#abb2bf", /* white */
/* 8 bright colors */
[8] = "#545862", /* black */
[9] = "#e06c75", /* red */
[10] = "#98c379", /* green */
[11] = "#e5c07b", /* yellow */
[12] = "#61afef", /* blue */
[13] = "#c678dd", /* magenta */
[14] = "#56b6c2", /* cyan */
[15] = "#c8ccd4", /* white */
[0] = "#073642", /* 0: black */
[1] = "#dc322f", /* 1: red */
[2] = "#859900", /* 2: green */
[3] = "#b58900", /* 3: yellow */
[4] = "#268bd2", /* 4: blue */
[5] = "#d33682", /* 5: magenta */
[6] = "#2aa198", /* 6: cyan */
[7] = "#eee8d5", /* 7: white */
[8] = "#002b36", /* 8: brblack */
[9] = "#cb4b16", /* 9: brred */
[10] = "#586e75", /* 10: brgreen */
[11] = "#657b83", /* 11: bryellow */
[12] = "#839496", /* 12: brblue */
[13] = "#6c71c4", /* 13: brmagenta*/
[14] = "#93a1a1", /* 14: brcyan */
[15] = "#fdf6e3", /* 15: brwhite */
};
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 */
};
unsigned int defaultfg = 7;
unsigned int defaultbg = 0;
static unsigned int defaultcs = 13;
static unsigned int defaultrcs = 0;
unsigned int defaultfg = 12;
unsigned int defaultbg = 8;
static unsigned int defaultcs = 14;
static unsigned int defaultrcs = 15;
static unsigned int defaultitalic = 7;
static unsigned int defaultunderline = 7;
@ -177,6 +193,7 @@ static Shortcut shortcuts[] = {
{TERMMOD, XK_I, iso14755, {.i = 0}},
{ShiftMask, XK_Page_Up, kscrollup, {.i = -1}},
{ShiftMask, XK_Page_Down, kscrolldown, {.i = -1}},
{XK_ANY_MOD, XK_F6, swapcolors, {.i = 0}},
};
@ -456,7 +473,6 @@ static uint selmasks[] = {
* Printable characters in ASCII, used to estimate the advance width
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
static char ascii_printable[] = " !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";

@ -126,6 +126,7 @@ extern char *vtiden;
extern char *worddelimiters;
extern int allowaltscreen;
extern char *termname;
extern int usealtcolors;
extern unsigned int tabspaces;
extern unsigned int alpha;
extern unsigned int defaultfg;

@ -57,6 +57,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 *);
@ -250,6 +251,21 @@ static char *opt_title = NULL;
static int oldbutton = 3; /* button event on startup: 3 = release */
int usealtcolors = 0; /* 1 to use alternate palette */
void
swapcolors(const Arg *dummy)
{
usealtcolors = !usealtcolors;
xloadcols();
redraw();
}
const char* getcolorname(int i)
{
return (usealtcolors) ? altcolorname[i] : colorname[i];
}
void
clipcopy(const Arg *dummy)
{
@ -737,7 +753,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);
@ -750,7 +766,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) {
@ -760,8 +776,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'\n", colorname[i]);
if (getcolorname(i))
die("Could not allocate color '%s'\n", getcolorname(i));
else
die("Could not allocate color %d\n", i);
}
@ -1154,13 +1170,13 @@ xinit(int cols, int rows)
xw.vpointer = XCreateFontCursor(xw.dpy, mouseshape);
XDefineCursor(xw.dpy, xw.win, xw.vpointer);
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(mousefg), &xmousebg) == 0) {
xmousebg.red = 0x0000;
xmousebg.green = 0x0000;
xmousebg.blue = 0x0000;
@ -1373,7 +1389,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]) {

Loading…
Cancel
Save