- mi.npixels = get_integer_resource ("ncolors", "Integer");
- if (mi.npixels <= 0)
- mi.npixels = 64;
- else if (mi.npixels > 256)
- mi.npixels = 256;
-
- mi.colors = (XColor *) calloc (mi.npixels, sizeof (*mi.colors));
-
- mi.writable_p = want_writable_colors;
-
- if (want_uniform_colors)
- make_uniform_colormap (dpy, mi.xgwa.visual, mi.xgwa.colormap,
- mi.colors, &mi.npixels,
- True, &mi.writable_p, True);
- else if (want_smooth_colors)
- make_smooth_colormap (dpy, mi.xgwa.visual, mi.xgwa.colormap,
- mi.colors, &mi.npixels,
- True, &mi.writable_p, True);
- else
- make_random_colormap (dpy, mi.xgwa.visual, mi.xgwa.colormap,
- mi.colors, &mi.npixels,
- want_bright_colors,
- True, &mi.writable_p, True);
-
- if (mi.npixels <= 2)
+ mi->npixels = get_integer_resource (dpy, "ncolors", "Integer");
+ if (mi->npixels <= 0)
+ mi->npixels = 64;
+ else if (mi->npixels > MAX_COLORS)
+ mi->npixels = MAX_COLORS;
+
+ mi->colors = (XColor *) calloc (mi->npixels, sizeof (*mi->colors));
+
+ mi->writable_p = mi->xlmft->want_writable_colors;
+
+ switch (mi->xlmft->desired_color_scheme)
+ {
+ case color_scheme_uniform:
+ make_uniform_colormap (dpy, mi->xgwa.visual, mi->xgwa.colormap,
+ mi->colors, &mi->npixels,
+ True, &mi->writable_p, True);
+ break;
+ case color_scheme_smooth:
+ make_smooth_colormap (dpy, mi->xgwa.visual, mi->xgwa.colormap,
+ mi->colors, &mi->npixels,
+ True, &mi->writable_p, True);
+ break;
+ case color_scheme_bright:
+ case color_scheme_default:
+ make_random_colormap (dpy, mi->xgwa.visual, mi->xgwa.colormap,
+ mi->colors, &mi->npixels,
+ (mi->xlmft->desired_color_scheme ==
+ color_scheme_bright),
+ True, &mi->writable_p, True);
+ break;
+ default:
+ abort();
+ }
+
+ if (mi->npixels <= 2)