+ unsigned long white = WhitePixel(xw.dis, xw.scr);
+
+ for(i = 0; i < 16; i++) {
+ if (!XAllocNamedColor(xw.dis, cmap, colorname[i], &color, &color)) {
+ dc.col[i] = white;
+ fprintf(stderr, "Could not allocate color '%s'\n", colorname[i]);
+ } else
+ dc.col[i] = color.pixel;
+ }
+
+ /* same colors as xterm */
+ for(r = 0; r < 6; r++)
+ for(g = 0; g < 6; g++)
+ for(b = 0; b < 6; b++) {
+ color.red = r == 0 ? 0 : 0x3737 + 0x2828 * r;
+ color.green = g == 0 ? 0 : 0x3737 + 0x2828 * g;
+ color.blue = b == 0 ? 0 : 0x3737 + 0x2828 * b;
+ if (!XAllocColor(xw.dis, cmap, &color)) {
+ dc.col[i] = white;
+ fprintf(stderr, "Could not allocate color %d\n", i);
+ } else
+ dc.col[i] = color.pixel;
+ i++;
+ }