shithub: patch

Download patch

ref: 05e2c28ac68c2fde17202df64b4aa94c5bc7340e
parent: 6c07047839dbeef6a08f3f4873dd3d51869456ce
author: qwx <qwx@sciops.net>
date: Sun Nov 14 19:26:36 EST 2021

add fm-col: fm(1) colors

--- /dev/null
+++ b/fm-col
@@ -1,0 +1,70 @@
+diff 021767d217ac1a04e51d8c03fcc5bfae881b6fd8 uncommitted
+--- a/main.c
++++ b/main.c
+@@ -27,6 +27,7 @@
+ Keyboardctl *kctl;
+ Image *selbg;
+ Image *mfg;
++Image *textfg;
+ Image *tick;
+ Rectangle ir;
+ Rectangle lr;
+@@ -131,8 +132,8 @@
+ {
+ 	if(loff + i >= nmatches)
+ 		return;
+-	draw(screen, linerect(i), sel ? selbg : display->white, nil, ZP);
+-	string(screen, addpt(lr.min, Pt(0, i * lh)), display->black, ZP, font, matches[loff + i].name);
++	draw(screen, linerect(i), sel ? selbg : display->black, nil, ZP);
++	string(screen, addpt(lr.min, Pt(0, i * lh)), textfg, ZP, font, matches[loff + i].name);
+ }
+ 
+ void
+@@ -143,9 +144,9 @@
+ 	Rectangle r;
+ 	int i;
+ 
+-	draw(screen, screen->r, display->white, nil, ZP);
+-	p = string(screen, addpt(screen->r.min, Pt(Padding, Padding)), display->black, ZP, font, "> ");
+-	p = stringn(screen, p, display->black, ZP, font, input, ninput);
++	draw(screen, screen->r, display->black, nil, ZP);
++	p = string(screen, addpt(screen->r.min, Pt(Padding, Padding)), textfg, ZP, font, "> ");
++	p = stringn(screen, p, textfg, ZP, font, input, ninput);
+ 	r = Rect(p.x, p.y, p.x + Dx(tick->r), p.y + Dy(tick->r));
+ 	draw(screen, r, tick, nil, ZP);	
+ 	for(i = 0; i < lcount; i++)
+@@ -313,16 +314,16 @@
+ {
+ 	Image *t;
+ 
+-	t = allocimage(display, Rect(0, 0, Tickw, font->height), screen->chan, 0, DWhite);
++	t = allocimage(display, Rect(0, 0, Tickw, font->height), screen->chan, 0, 0x884400FF);
+ 	if(t == nil)
+ 		return 0;
+ 	/* background color */
+-	draw(t, t->r, display->white, nil, ZP);
++	draw(t, t->r, display->black, nil, ZP);
+ 	/* vertical line */
+-	draw(t, Rect(Tickw/2, 0, Tickw/2+1, font->height), display->black, nil, ZP);
++	draw(t, Rect(Tickw/2, 0, Tickw/2+1, font->height), textfg, nil, ZP);
+ 	/* box on each end */
+-	draw(t, Rect(0, 0, Tickw, Tickw), display->black, nil, ZP);
+-	draw(t, Rect(0, font->height-Tickw, Tickw, font->height), display->black, nil, ZP);
++	draw(t, Rect(0, 0, Tickw, Tickw), textfg, nil, ZP);
++	draw(t, Rect(0, font->height-Tickw, Tickw, font->height), textfg, nil, ZP);
+ 	return t;
+ }
+ 
+@@ -370,9 +371,10 @@
+ 	a[Emouse].c = mctl->c;
+ 	a[Eresize].c = mctl->resizec;
+ 	a[Ekeyboard].c = kctl->c;
++	textfg = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x884400FF);
++	selbg = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x440000FF);
++	mfg = selbg;
+ 	tick = createtick();
+-	selbg = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0xEFEFEFFF);
+-	mfg = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x999999FF);
+ 	loff = 0;
+ 	lsel = 0;
+ 	eresize();