shithub: nc

Download patch

ref: d746543eaed06a1027b5faf07ce37963710d36c2
parent: ebae74851bf08ade421fc24cc7f07475506fe6f4
author: phil9 <telephil9@gmail.com>
date: Sat Dec 31 03:26:52 EST 2022

tweak colors (mainly for dark mode)

--- a/a.h
+++ b/a.h
@@ -184,8 +184,10 @@
 	Ctitle,
 	Cborder,
 	Csel,
+	Cselfg,
 	Cerror,
-	Cdialog,
+	Cdlgbg,
+	Cdlgbord,
 	Ncols
 };
 extern Image*		cols[Ncols];
--- a/actionbar.c
+++ b/actionbar.c
@@ -32,7 +32,7 @@
 		draw(abar->b, wr, cols[Ctitle], nil, ZP);
 		p.x += 2;
 		if(abar->labels[i] != nil)
-			string(abar->b, p, cols[Cfg], ZP, font, abar->labels[i]);
+			string(abar->b, p, cols[Cselfg], ZP, font, abar->labels[i]);
 	}
 }
 
--- a/dirpanel.c
+++ b/dirpanel.c
@@ -80,10 +80,12 @@
 	r.min.y += index * (1 + font->height + 1);
 	r.max.x -= 2;
 	r.max.y = r.min.y + 1 + font->height + 1;
+	f = cols[Cfg];
 	b = cols[Cbg];
-	if(index == p->cursor && p->focused)
+	if(index == p->cursor && p->focused){
+		f = cols[Cselfg];
 		b = cols[Csel];
-	f = cols[Cfg];
+	}
 	if(p->model->sel[p->offset + index])
 		f = cols[Ctitle];
 	else if(!p->focused)
--- a/input.c
+++ b/input.c
@@ -19,7 +19,7 @@
 	int dx;
 
 	dx = (Dx(br) - stringwidth(font, label)) / 2;
-	border(b, br, 2, focus ? cols[Ctitle] : cols[Csel], ZP);
+	border(b, br, 2, focus ? cols[Ctitle] : cols[Cdlgbord], ZP);
 	p = addpt(br.min, Pt(dx, 0.25*font->height));
 	p = stringn(b, p, cols[Ctitle], ZP, font, label, 1);
 	string(b, p, cols[Cfg], ZP, font, label+1);
@@ -61,7 +61,7 @@
 		;
 	rc = -1;
 	len = strlen(buf);
-	bg = cols[Cdialog];
+	bg = cols[Cdlgbg];
 	fg = cols[Cfg];
 	hi = cols[Ctitle];
 	focus = 0;
@@ -87,7 +87,7 @@
 			draw(save, r, b, nil, r.min);
 		}
 		draw(b, r, bg, nil, ZP);
-		border(b, r, Border, cols[Csel], ZP);
+		border(b, r, Border, cols[Cdlgbord], ZP);
 		p = addpt(o, Pt(0, 2));
 		line(b, p, Pt(r.max.x, p.y), 0, 0, 2, hi, ZP);
 		p = addpt(o, Pt(Border+Padding, Border+Padding+0.5*font->height));
--- a/main.c
+++ b/main.c
@@ -24,17 +24,21 @@
 		cols[Ctitle] = ealloccolor(DGreygreen);
 		cols[Cborder] = ealloccolor(0xAAAAAAFF);
 		cols[Csel] = ealloccolor(0xCCCCCCFF);
+		cols[Cselfg] = display->black;
 		cols[Cerror] = ealloccolor(0x721c24ff);
-		cols[Cdialog] = ealloccolor(0xFAFAFAFF);
+		cols[Cdlgbg] = ealloccolor(0xFAFAFAFF);
+		cols[Cdlgbord] = ealloccolor(0xCCCCCCFF);
 	}else{
 		cols[Cbg] = display->black;
 		cols[Cfg] = display->white;
-		cols[Clfg] = ealloccolor(0xAAAAAAFF^1);
+		cols[Clfg] = ealloccolor(0x666666FF);
 		cols[Ctitle] = ealloccolor(DPurpleblue);
 		cols[Cborder] = ealloccolor(0x333333FF);
-		cols[Csel] = ealloccolor(0x666666FF);
+		cols[Csel] = ealloccolor(DPurpleblue);
+		cols[Cselfg] = display->black;
 		cols[Cerror] = ealloccolor(DRed);
-		cols[Cdialog] = ealloccolor(0x1A1A1AFF);
+		cols[Cdlgbg] = ealloccolor(0x1A1A1AFF);
+		cols[Cdlgbord] = ealloccolor(0x666666FF);
 	}
 }
 
--- a/message.c
+++ b/message.c
@@ -19,7 +19,7 @@
 	int dx;
 
 	dx = (Dx(br) - stringwidth(font, label)) / 2;
-	border(b, br, 2, focus ? cols[Ctitle] : cols[Csel], ZP);
+	border(b, br, 2, focus ? cols[Ctitle] : cols[Cdlgbord], ZP);
 	p = addpt(br.min, Pt(dx, 0.25*font->height));
 	p = stringn(b, p, cols[Ctitle], ZP, font, label, 1);
 	string(b, p, cols[Cfg], ZP, font, label+1);
@@ -49,7 +49,7 @@
 		;
 	focus = 0;
 	rc = Bno;
-	bg = cols[Cdialog];
+	bg = cols[Cdlgbg];
 	fg = cols[Cfg];
 	hi = type == Derror ? cols[Cerror] : cols[Ctitle];
 	done = 0;
@@ -72,7 +72,7 @@
 			draw(save, r, b, nil, r.min);
 		}
 		draw(b, r, bg, nil, ZP);
-		border(b, r, Border, cols[Csel], ZP);
+		border(b, r, Border, cols[Cdlgbord], ZP);
 		p = addpt(o, Pt(0, 2));
 		line(b, p, Pt(r.max.x, p.y), 0, 0, 2, hi, ZP);
 		p = addpt(o, Pt(Border+Padding, Border+Padding+0.5*font->height));