next up previous contents
Next: Errors Up: Programming Tips Previous: Getting arguments

Colors

There's no way of telling how many colorcells are unallocated.

Your program should work on both monochrome and color screens if possible using something like the following code.

Bool iscolor;
Xcolor blue;
iscolor = (XDisplayCells(display, screen)>2);
foreground = (iscolor &&
              XParsecolor(display,cmap, "blue",&blue) &&
              XAllocColor(display,cmap, &blue))
                    ? blue.pixel : BlackPixel (display,screen));


Tim Love
Mon Mar 11 17:03:18 GMT 1996