- gcv.foreground = fg;
- gcv.background = bg;
- draw_gc = XCreateGC (dpy, window, GCForeground|GCBackground, &gcv);
+ colors[0].pixel = bg;
+ colors[0].flags = DoRed|DoGreen|DoBlue;
+ XQueryColor(dpy, cmap, &colors[0]);
+
+ ncolors--;
+ make_random_colormap(dpy, xgwa.visual, cmap, colors+1, &ncolors, True,
+ True, 0, True);
+ ncolors++;
+
+ if (ncolors < 2)
+ {
+ ncolors = 2;
+ mono_p = True;
+ }
+
+ if (mono_p)
+ {
+ unsigned int fg = get_pixel_resource("foreground", "Foreground",
+ dpy, cmap);
+ colors[1].pixel = fg;
+ colors[1].flags = DoRed|DoGreen|DoBlue;
+ XQueryColor(dpy, cmap, &colors[1]);
+ gcv.foreground = fg;
+ gcv.background = bg;
+ draw_gcs[0] = XCreateGC (dpy, window, GCForeground|GCBackground, &gcv);
+ draw_gcs[1] = draw_gcs[0];
+ }
+ else
+ for( i = 0; i < ncolors; i++ )
+ {
+ gcv.foreground = colors[i].pixel;
+ gcv.background = bg;
+ draw_gcs[i] = XCreateGC (dpy, window, GCForeground|GCBackground, &gcv);
+ }
+