- make_random_colormap (dpy, xgwa.visual, xgwa.colormap,
- colors, &ncolors, True, True, 0, True);
+
+ transparent_p = get_boolean_resource("transparent", "Transparent");
+
+ colors = (XColor *) calloc (sizeof(*colors), ncolors);
+
+ if (get_boolean_resource("mono", "Boolean"))
+ {
+ MONO:
+ ncolors = 1;
+ colors[0].pixel = get_pixel_resource("foreground", "Foreground",
+ dpy, xgwa.colormap);
+ }
+ else if (transparent_p)
+ {
+ nplanes = get_integer_resource ("planes", "Planes");
+ if (nplanes <= 0)
+ nplanes = (random() % (xgwa.depth-2)) + 2;
+
+ allocate_alpha_colors (xgwa.screen, xgwa.visual, xgwa.colormap,
+ &nplanes, True, &plane_masks,
+ &base_pixel);
+ if (nplanes <= 1)
+ {
+ fprintf (stderr,
+ "%s: couldn't allocate any color planes; turning transparency off.\n",
+ progname);
+ transparent_p = False;
+ goto COLOR;
+ }
+ }
+ else
+ {
+ COLOR:
+ make_random_colormap (dpy, xgwa.visual, xgwa.colormap,
+ colors, &ncolors, True, True, 0, True);
+ if (ncolors < 2)
+ goto MONO;
+ }