commit aa3381c
ohmu
·
2026-09-22 22:53:50 +0300 MSK
parent 6371300
added tile pattern colors
7 files changed,
+58,
-25
M
acme.1
+19,
-0
1@@ -167,6 +167,25 @@ Button 2 highlight. Default: 0xAA0000FF.
2 .B btn3hl
3 Button 3 highlight. Default: 0x006600FF.
4 .TP
5+.B coolscrlfg
6+Foreground (dot) color of the coolscrollbg 1 and 2 tile pattern. Not affected by
7+.BR pastels .
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+Default: 0xFFFFFFFF.
14+.TP
15+.B coolwinfg
16+Foreground (dot) color of the coolwinbtn tile pattern. Not affected by
17+.BR pastels .
18+Default: 0xFFFFFFFF.
19+.TP
20+.B coolwinbg
21+Background color of the coolwinbtn tile pattern. Not affected by
22+.BR pastels .
23+Default: 0x000000FF.
24 .B mainfont
25 Main font path. Default:
26 .IR /lib/font/bit/lucsans/euro.8.font .
M
acme.c
+10,
-10
1@@ -966,12 +966,11 @@ ispastel(char *color)
2 }
3
4 Image*
5-tilebit(int dark)
6+tilebit(uint32_t tilebg, uint32_t tilefg)
7 {
8 Image *t, *fg;
9-
10- fg = dark ? display->white : display->black;
11- t = allocimage(display, Rect(0,0,4,2), screen->chan, 1, dark ? DBlack : DWhite);
12+ fg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, tilefg);
13+ t = allocimage(display, Rect(0,0,4,2), screen->chan, 1, tilebg);
14 if(t == nil)
15 return nil;
16 draw(t, Rect(0,0,1,1), fg, nil, ZP);
17@@ -1021,11 +1020,12 @@ iconinit(void)
18 else
19 textcols[HIGH] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTHLBG);
20
21- if(coolscrollbg) {
22- textcols[BORD] = allocimage(display, Rect(0,0,2,2), CMAP8, 1, 0x000000FF);
23- draw(textcols[BORD], Rect(1,1,2,2), display->white, nil, ZP);
24- draw(textcols[BORD], Rect(0,0,1,1), display->white, nil, ZP);
25- }else{
26+ if(coolscrollbg == 1) {
27+ tmp = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLTILEFG);
28+ textcols[BORD] = allocimage(display, Rect(0,0,2,2), RGBA32, 1, C_SCROLLTILEBG);
29+ draw(textcols[BORD], Rect(1,1,2,2), tmp, nil, ZP);
30+ draw(textcols[BORD], Rect(0,0,1,1), tmp, nil, ZP);
31+ }else if(coolscrollbg == 0){
32 if(ispastel("scrlbg"))
33 textcols[BORD] = allocimagemix(display, C_SCROLLBG, C_MIX);
34 else
35@@ -1136,7 +1136,7 @@ iconinit(void)
36 rr.max.y--;
37 rr.max.x++;
38 draw(colbutton, insetrect(rr, 1), tagcols[BORD], nil, ZP);
39- tmp = tilebit(1);
40+ tmp = tilebit(C_WINBTNTILEBG, C_WINBTNTILEFG);
41 draw(colbutton, insetrect(rr, 2), tmp, nil, ZP);
42 freeimage(tmp);
43 }else if(ispastel("winbtn"))
+9,
-4
1@@ -1,9 +1,14 @@
2 mainfont /tmp/fonts/gallant12x22/16/font
3 monofont /tmp/fonts/gallant12x22/16/font
4
5-coolcolbtn 1
6-coolscrollbg 0
7-coolwinbtn 0
8+coolcolbtn 3
9+coolscrollbg 2
10+coolwinbtn 1
11+
12+coolscrlfg 7C5557
13+coolscrlbg 0F0202
14+coolwinfg 7C5557
15+coolwinbg 0F0202
16
17 pastels 0
18 mix ffffff
19@@ -22,7 +27,7 @@ htxtfg ffffff
20 winbtn 9E7779
21 winbtnbord 7C5557
22 colbtn 7C5557
23-tmpbtn ffffff
24+tmpbtn 7C5557
25 scrlbg 7C5557
26 scrlfg 0F0202
27 scrlbord 7C5557
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(int dark);
6+Image *tilebit(uint32_t tilebg, uint32_t tilefg);
7 void iconinit(void);
8 int ispastel(char *color);
9 Timer* timerstart(int);
M
parser.c
+4,
-0
1@@ -178,6 +178,10 @@ initconfig(char *custom_config)
2 C_SCROLLBORDER = getcolor(f, "scrlbord", 0x99994CFF);
3 C_BUTTON2HL = getcolor(f, "btn2hl", 0xAA0000FF);
4 C_BUTTON3HL = getcolor(f, "btn3hl", 0x006600FF);
5+ C_SCROLLTILEFG = getcolor(f, "coolscrlfg", 0x000000FF);
6+ C_SCROLLTILEBG = getcolor(f, "coolscrlbg", 0xFFFFFFFF);
7+ C_WINBTNTILEFG = getcolor(f, "coolwinfg", 0xFFFFFFFF);
8+ C_WINBTNTILEBG = getcolor(f, "coolwinbg", 0x000000FF);
9
10 mainfont = parsekeyvalue(f, "mainfont", "/lib/font/bit/lucsans/euro.8.font");
11 monofont = parsekeyvalue(f, "monofont", "/lib/font/bit/lucm/unicode.9.font");
M
parser.h
+4,
-0
1@@ -27,6 +27,10 @@ uint32_t C_SCROLLFG;
2 uint32_t C_SCROLLBORDER;
3 uint32_t C_BUTTON2HL;
4 uint32_t C_BUTTON3HL;
5+uint32_t C_SCROLLTILEFG;
6+uint32_t C_SCROLLTILEBG;
7+uint32_t C_WINBTNTILEFG;
8+uint32_t C_WINBTNTILEBG;
9
10 char *mainfont;
11 char *monofont;
M
scrl.c
+11,
-10
1@@ -80,21 +80,27 @@ textscrdraw(Text *t)
2 r2 = scrpos(r1, t->org, t->org+t->fr.nchars, t->file->b.nc, customscrl);
3 if(!eqrect(r2, t->lastsr)){
4 t->lastsr = r2;
5+ if(scrollborder == nil){
6+ if(ispastel("scrlbord"))
7+ scrollborder = allocimagemix(display, C_SCROLLBORDER, C_MIX);
8+ else
9+ scrollborder = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLBORDER);
10+ }
11 if(customscrl){
12- /* frame, light grey trough, white thumb capped by black lines */
13- tile = tilebit(0);
14- draw(b, r1, display->black, nil, ZP);
15+ /* frame, light grey trough, white thumb capped by scrollborder lines */
16+ tile = tilebit(C_SCROLLTILEBG, C_SCROLLTILEFG);
17+ draw(b, r1, scrollborder, nil, ZP);
18 draw(b, insetrect(r1, 1), tile, nil, ZP);
19 freeimage(tile);
20 draw(b, r2, t->fr.cols[BACK], nil, ZP);
21 r3 = r2;
22 r3.max.y = r3.min.y;
23 r3.min.y--;
24- draw(b, r3, display->black, nil, ZP);
25+ draw(b, r3, scrollborder, nil, ZP);
26 r3 = r2;
27 r3.min.y = r3.max.y;
28 r3.max.y++;
29- draw(b, r3, display->black, nil, ZP);
30+ draw(b, r3, scrollborder, nil, ZP);
31 /* the 1px gap left of the bar */
32 r3 = t->scrollr;
33 r3.max.x = r3.min.x+1;
34@@ -105,11 +111,6 @@ textscrdraw(Text *t)
35 scrollfg = allocimagemix(display, C_SCROLLFG, C_MIX);
36 else
37 scrollfg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLFG);
38-
39- if(ispastel("scrlbord"))
40- scrollborder = allocimagemix(display, C_SCROLLBORDER, C_MIX);
41- else
42- scrollborder = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLBORDER);
43 }
44 draw(b, r1, t->fr.cols[BORD], nil, ZP);
45 draw(b, r2, scrollfg, nil, ZP);