Added solarized theme
							parent
							
								
									2c22d95d5b
								
							
						
					
					
						commit
						63733ff8da
					
				
							
								
								
									
										73
									
								
								config.def.h
								
								
								
								
							
							
						
						
									
										73
									
								
								config.def.h
								
								
								
								
							|  | @ -119,43 +119,53 @@ float alpha = 0.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", | ||||
| 	"black", | ||||
| 	/* 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  */ | ||||
| }; | ||||
| /*
 | ||||
|  * Default colors (colorname index) | ||||
|  * foreground, background, cursor, reverse cursor | ||||
|  */ | ||||
| unsigned int defaultfg = 7; | ||||
| unsigned int defaultbg = 258; | ||||
| 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 | ||||
|  | @ -228,6 +238,7 @@ static Shortcut shortcuts[] = { | |||
| 	{ TERMMOD,              XK_Num_Lock,    numlock,        {.i =  0} }, | ||||
| 	{ ShiftMask,            XK_Page_Up,     kscrollup,      {.i = -1} }, | ||||
| 	{ ShiftMask,            XK_Page_Down,   kscrolldown,    {.i = -1} }, | ||||
| 	{ XK_ANY_MOD,           XK_F6,          swapcolors,     {.i =  0} }, | ||||
| }; | ||||
| 
 | ||||
| /*
 | ||||
|  |  | |||
							
								
								
									
										75
									
								
								config.h
								
								
								
								
							
							
						
						
									
										75
									
								
								config.h
								
								
								
								
							|  | @ -10,7 +10,7 @@ static char *font2[] = { | |||
|     "Noto Color Emoji:size=10:antialias=true;autohint=true" | ||||
| }; | ||||
| static int borderpx = 2; | ||||
| float alpha = 0.8; | ||||
| float alpha = 0.95; | ||||
| 
 | ||||
| /* Lines to move per scroll */ | ||||
| const unsigned int mousescrollincrement = 5; | ||||
|  | @ -105,44 +105,54 @@ char *termname = "st-256color"; | |||
|  */ | ||||
| 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  */ | ||||
| }; | ||||
| /*
 | ||||
|  * 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 | ||||
|  | @ -215,6 +225,7 @@ static Shortcut shortcuts[] = { | |||
| 	{ TERMMOD,              XK_Num_Lock,    numlock,        {.i =  0} }, | ||||
| 	{ ShiftMask,            XK_Page_Up,     kscrollup,      {.i = -1} }, | ||||
| 	{ ShiftMask,            XK_Page_Down,   kscrolldown,    {.i = -1} }, | ||||
| 	{ XK_ANY_MOD,           XK_F6,          swapcolors,     {.i =  0} }, | ||||
| }; | ||||
| 
 | ||||
| /*
 | ||||
|  |  | |||
							
								
								
									
										1
									
								
								st.h
								
								
								
								
							
							
						
						
									
										1
									
								
								st.h
								
								
								
								
							|  | @ -134,6 +134,7 @@ extern wchar_t *worddelimiters; | |||
| extern int allowaltscreen; | ||||
| extern int allowwindowops; | ||||
| extern char *termname; | ||||
| extern int usealtcolors; | ||||
| extern unsigned int tabspaces; | ||||
| extern unsigned int defaultfg; | ||||
| extern unsigned int defaultbg; | ||||
|  |  | |||
							
								
								
									
										28
									
								
								x.c
								
								
								
								
							
							
						
						
									
										28
									
								
								x.c
								
								
								
								
							|  | @ -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 *); | ||||
|  | @ -266,6 +267,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) | ||||
| { | ||||
|  | @ -304,6 +307,14 @@ numlock(const Arg *dummy) | |||
| 	win.mode ^= MODE_NUMLOCK; | ||||
| } | ||||
| 
 | ||||
| void | ||||
| swapcolors(const Arg *dummy) | ||||
| { | ||||
|  usealtcolors = !usealtcolors; | ||||
|  xloadcols(); | ||||
|  redraw(); | ||||
| } | ||||
| 
 | ||||
| void | ||||
| zoom(const Arg *arg) | ||||
| { | ||||
|  | @ -780,6 +791,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) | ||||
| { | ||||
|  | @ -798,7 +814,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); | ||||
|  | @ -821,8 +837,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); | ||||
| 		} | ||||
|  | @ -1318,13 +1334,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(mousebg), &xmousebg) == 0) { | ||||
| 		xmousebg.red   = 0x0000; | ||||
| 		xmousebg.green = 0x0000; | ||||
| 		xmousebg.blue  = 0x0000; | ||||
|  | @ -1544,7 +1560,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…
	
		Reference in New Issue