Read-only colormap cells are shared among clients. The server counts each allocation and free of the cell by clients. When the last client frees a shared cell, the cell is finally deallocated. If a single client allocates the same read-only cell multiple times, the server counts each such allocation, not just the first one.
To allocate a read-only color cell with an RGB value, use XAllocColor().
To allocate a read-only color cell with a color in arbitrary format, use XcmsAllocColor().
To allocate a read-only color cell using a color name and return the closest color supported by the hardware in RGB format, use XAllocNamedColor().
To allocate a read-only color cell using a color name and return the closest color supported by the hardware in an arbitrary format, use XcmsAllocNamedColor().
To allocate read/write color cell and color plane combinations for a PseudoColor model, use XAllocColorCells().
To allocate read/write color resources for a DirectColor model, use XAllocColorPlanes().
To free colormap cells, use XFreeColors().