From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from asquith.prosimetrum.com ([125.236.209.157]) by ewsd; Fri Mar 20 01:00:11 EDT 2020 Message-ID: <4BD638D767606C3EA7FA4A65D8F4EB1D@prosimetrum.com> Date: Fri, 20 Mar 2020 18:04:05 +1300 From: umbraticus@prosimetrum.com To: 9front@9front.org Subject: Re: [9front] mothra: proposal In-Reply-To: <86C8667F-F6B5-4941-809F-57B504CBD69B@stanleylieber.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: distributed object-oriented SVG plugin strategy-oriented controller Default colours work for me, and I haven't checked out how libtheme works, but it occured to me that programs often have an array of colours, which you could prime with an rc list thus: ; colours = (ff aaaaaaff ffffffff) myprog # -b Sure, you need to look at the source to work out which colour is which, but you don't have to edit it and recompile, just put your weird preferences in a script. If that's what you're into. envcolours() could go in the lib... eg: (excuse my spelling) #include #include #include enum{ONE, TWO, THREE, NCOL}; ulong rgb[NCOL] = {[ONE] 0xff0000ff, [TWO] 0x00ff00ff, [THREE] 0x0000ffff}; void envcolours(Image **a, int n){ char *s; int i; if(s = getenv("colours")) for(i = 0, s = strtok(s, " "); i < n && s != nil; i++, s = strtok(nil, " ")) rgb[i] = strtoul(s, nil, 16); } void main(int, char**){ Image *col[NCOL]; Rectangle r; int i; if(initdraw(nil, nil, "colours") < 0) sysfatal("initdraw: %r"); r = Rect(0, 0, 1, 1); envcolours(col, NCOL); for(i = 0; i < NCOL; i++) if((col[i] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, rgb[i])) == nil) sysfatal("allocimage: %r"); r = screen->r; i = Dy(r) / 6; draw(screen, r, col[ONE], nil, ZP); r = insetrect(r, i); draw(screen, r, col[TWO], nil, ZP); r = insetrect(r, i); draw(screen, r, col[THREE], nil, ZP); flushimage(display, 1); sleep(5000); } umbraticus