+ delay2 = get_integer_resource ("delay2", "Integer") * 1000000;
+ cycle_delay = get_integer_resource ("cycleDelay", "Integer");
+ mode_str = get_string_resource ("colorMode", "ColorMode");
+ if (! mode_str) cmode = random_mode;
+ else if (!strcmp (mode_str, "seuss")) cmode = seuss_mode;
+ else if (!strcmp (mode_str, "ramp")) cmode = ramp_mode;
+ else if (!strcmp (mode_str, "random")) cmode = random_mode;
+ else {
+ fprintf (stderr,
+ "%s: colorMode must be seuss, ramp, or random, not \"%s\"\n",
+ progname, mode_str);
+ exit (1);
+ }
+
+ if (mono_p) cmode = seuss_mode;
+ if (cmode == random_mode)
+ cmode = ((random()&3) == 1) ? ramp_mode : seuss_mode;
+
+ if (cmode == ramp_mode)
+ anim_p = False; /* This combo doesn't work right... */
+
+ ncolors = get_integer_resource ("colors", "Colors");
+ if (ncolors < 2) ncolors = 2;
+ if (ncolors <= 2) mono_p = True;
+
+ if (mono_p)
+ colors = 0;
+ else
+ colors = (XColor *) malloc(sizeof(*colors) * (ncolors+1));
+
+ cycle_p = mono_p ? False : get_boolean_resource ("cycle", "Cycle");
+
+ /* If the visual isn't color-indexed, don't bother trying to
+ allocate writable cells. */
+ if (cycle_p && !has_writable_cells (xgwa.screen, xgwa.visual))
+ cycle_p = False;
+
+
+ if (mono_p)
+ ;
+ else if (random() % (cmode == seuss_mode ? 2 : 10))
+ make_uniform_colormap (dpy, xgwa.visual, cmap, colors, &ncolors,
+ True, &cycle_p, True);
+ else
+ make_smooth_colormap (dpy, xgwa.visual, cmap, colors, &ncolors,
+ True, &cycle_p, True);
+
+ if (ncolors <= 2) mono_p = True;
+ if (mono_p) cycle_p = False;
+ if (mono_p) cmode = seuss_mode;
+