|  | Re: .0
The server and toolkit allocate read-only colors as needed, and you *can't*
change those colors, as far as I can tell.  Your choices are:
	(1) Call XAllocNamedColor to ask for a specific color. If another
	    application is already using that color you'll share the same
	    color map entry (and can't change it).  If that color hasn't
	    already been allocated and there are unused entries in the
	    default colormap, the server will allocate a color number for
	    you, set color entry to the color you asked for, and mark the
	    entry as read-only.  If there are no free entries XAllocNamedColor
	    returns an error.
	(2) Call XAllocColorCells (or another routine) to allocate one or more
	    colormap entries for your exclusive read-write use.  If there
	    aren't enough entries available in the default colormap
	    XAllocColorCells will return an error.
	(3) Call XCreateColormap to create your own private colormap for your
	    exclusive read-write use; you'll also need to call
	    XSetWindowColormap and possibly XLoadColormap.  When your window
	    gets the input focus the window manager will set the hardware
	    colormap to your colormap, and your window will be the only one
	    displayed in its true colors.  When your window loses the input
	    focus the hardware colormap reverts to the default colormap, so
	    your window won't be displayed in its true colors.  I got a lot
	    of complaints when I did this in DECterm.
You can also combine these methods: you can try allocating entries from the
default colormap as in (1) or (2), and if the allocation fails you can create
a private colormap by calling XCopyColormapAndFree; this creates a new colormap
and copies all your entries from the default colormap to the new colormap and
frees them in the default colormap.
What I'd like to be able to do is to look at the colors that exist in the
hardware colormap and find out which ones are available for shared access;
that way I could ask for a color, say OrangeRed, say DarkOliveGreen, and if
XAllocNamedColor failed I could fall back to the closest available color, say
DarkGreen.  As far as I can tell, though, there is no way to do this.
				-- Bob
 |