+ ncolors = get_integer_resource ("colors", "Colors");
+ if (ncolors < 2) ncolors = 2;
+ if (ncolors <= 2) mono_p = True;
+ colors = 0;
+
+ if (!mono_p)
+ {
+ fg_index = 0;
+ switch (mode)
+ {
+ case ball_mode:
+ if (glow_p)
+ {
+ int H = random() % 360;
+ double S1 = 0.25;
+ double S2 = 1.00;
+ double V = frand(0.25) + 0.75;
+ colors = (XColor *) malloc(sizeof(*colors) * (ncolors+1));
+ make_color_ramp (dpy, cmap, H, S1, V, H, S2, V, colors, &ncolors,
+ False, True, False);
+ }
+ else
+ {
+ ncolors = npoints;
+ colors = (XColor *) malloc(sizeof(*colors) * (ncolors+1));
+ make_random_colormap (dpy, xgwa.visual, cmap, colors, &ncolors,
+ True, True, False, True);
+ }
+ break;
+ case line_mode:
+ case polygon_mode:
+ case spline_mode:
+ case spline_filled_mode:
+ case tail_mode:
+ colors = (XColor *) malloc(sizeof(*colors) * (ncolors+1));
+ make_smooth_colormap (dpy, xgwa.visual, cmap, colors, &ncolors,
+ True, False, True);
+ break;
+ default:
+ abort ();
+ }
+ }
+
+ if (!mono_p && ncolors <= 2)
+ {
+ if (colors) free (colors);
+ colors = 0;
+ mono_p = True;
+ }
+