commit f8c5ad2

ohmu  ·  2026-09-23 02:42:39 +0300 MSK
parent aa3381c
tile pattern colors now supports pastels
4 files changed,  +23, -15
M acme.1
M acme.c
M fns.h
M scrl.c
M acme.1
+4, -8
 1@@ -168,23 +168,19 @@ Button 2 highlight.  Default: 0xAA0000FF.
 2 Button 3 highlight.  Default: 0x006600FF.
 3 .TP
 4 .B coolscrlfg
 5-Foreground (dot) color of the coolscrollbg 1 and 2 tile pattern.  Not affected by
 6-.BR pastels .
 7+Foreground (dot) color of the coolscrollbg 1 and 2 tile pattern.
 8 Default: 0x000000FF.
 9 .TP
10 .B coolscrlbg
11-Background color of the coolscrollbg 1 and 2 tile pattern.  Not affected by
12-.BR pastels .
13+Background color of the coolscrollbg 1 and 2 tile pattern.
14 Default: 0xFFFFFFFF.
15 .TP
16 .B coolwinfg
17-Foreground (dot) color of the coolwinbtn tile pattern.  Not affected by
18-.BR pastels .
19+Foreground (dot) color of the coolwinbtn tile pattern.
20 Default: 0xFFFFFFFF.
21 .TP
22 .B coolwinbg
23-Background color of the coolwinbtn tile pattern.  Not affected by
24-.BR pastels .
25+Background color of the coolwinbtn tile pattern.
26 Default: 0x000000FF.
27 .B mainfont
28 Main font path.  Default:
M acme.c
+17, -5
 1@@ -966,15 +966,27 @@ ispastel(char *color)
 2 }
 3 
 4 Image*
 5-tilebit(uint32_t tilebg, uint32_t tilefg)
 6+tilebit(uint32_t tilebg, char *bgkey, uint32_t tilefg, char *fgkey)
 7 {
 8 	Image *t, *fg;
 9-	fg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, tilefg);
10-	t = allocimage(display, Rect(0,0,4,2), screen->chan, 1, tilebg);
11-	if(t == nil)
12+
13+	if(ispastel(fgkey))
14+		fg = allocimagemix(display, tilefg, C_MIX);
15+	else
16+		fg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, tilefg);
17+
18+	if(ispastel(bgkey))
19+		t = allocimagemix(display, tilebg, C_MIX);
20+	else
21+		t = allocimage(display, Rect(0,0,4,2), screen->chan, 1, tilebg);
22+	if(t == nil){
23+		freeimage(fg);
24 		return nil;
25+	}
26+
27 	draw(t, Rect(0,0,1,1), fg, nil, ZP);
28 	draw(t, Rect(2,1,3,2), fg, nil, ZP);
29+	freeimage(fg);
30 	return t;
31 }
32 
33@@ -1136,7 +1148,7 @@ iconinit(void)
34 		rr.max.y--;
35 		rr.max.x++;
36 		draw(colbutton, insetrect(rr, 1), tagcols[BORD], nil, ZP);
37-		tmp = tilebit(C_WINBTNTILEBG, C_WINBTNTILEFG);
38+		tmp = tilebit(C_WINBTNTILEBG, "coolwinbg", C_WINBTNTILEFG, "coolwinfg");
39 		draw(colbutton, insetrect(rr, 2), tmp, nil, ZP);
40 		freeimage(tmp);
41 	}else if(ispastel("winbtn"))
M fns.h
+1, -1
1@@ -47,7 +47,7 @@ void	killtasks(void);
2 int	runeeq(Rune*, uint, Rune*, uint);
3 int	ALEF_tid(void);
4 
5-Image *tilebit(uint32_t tilebg, uint32_t tilefg);
6+Image *tilebit(uint32_t tilebg, char *bgkey, uint32_t tilefg, char *fgkey);
7 void	iconinit(void);
8 int    ispastel(char *color);
9 Timer*	timerstart(int);
M scrl.c
+1, -1
1@@ -88,7 +88,7 @@ textscrdraw(Text *t)
2 		}
3 		if(customscrl){
4 			/* frame, light grey trough, white thumb capped by scrollborder lines */
5-			tile = tilebit(C_SCROLLTILEBG, C_SCROLLTILEFG);
6+			tile = tilebit(C_SCROLLTILEBG, "coolscrlbg", C_SCROLLTILEFG, "coolscrlfg");
7 			draw(b, r1, scrollborder, nil, ZP);
8 			draw(b, insetrect(r1, 1), tile, nil, ZP);
9 			freeimage(tile);