This section contains recommendations for using the Solaris X server color support facilities. Use these hints to maximize portability and color sharing:
Do not rely on the locations of black and white in the default PseudoColor colormap. Always use XAllocColor to allocate a pixel for rendering.
Do not rely on black and white being in certain pixel locations. Future versions of the Solaris X server and the servers of other vendors may have these colors located in different positions than the current server. For maximum portability and compatibility, always write X11 clients so that they use the XAllocColor function to allocate desired colors for rendering.
Do not use a visual before you have checked on all supported visual types, using XGetVisualInfo or XMatchVisualInfo. Note that XGetVisualInfo is the recommended function to use because it has the ability to distinguish between visuals of the same class and depth.
To reduce colormap flashing, it is usually a good policy to try to first allocate colors from the default colormap. Only when this allocation fails should you create a private colormap.
For more hints on writing portable X11 color clients, see Hints for Windows Programming With Visuals.