I made some additions to XPM that may be good, or intensely disliked by X purists. I do not know if the changes are compatable with current XPM.
The change was to make a "compressed colormap" that avoids XParseColor(), and gives the actual color values (which is really what everybody wants!). Only colormaps of this form, and ones where the colors are named as "#rrggbb", will be portable to non-X platforms.
A compressed colormap is indicated by the number of colors being negative. The colormap is then given as an array of 4*numcolors characters. Each color is described by 4 characters: the index character, and the red, green, and blue value (for 2-character indexes each color needs 5 characters).
XPM files support a single transparent index. I require this index to be ' ' (space). To indicate that ' ' is transparent, it should be first in the color table. To make ' ' not be transparent, put it somewhere other than first in the table.
To make the XPM files easily parseable, but still portable to most C compilers, I suggest the following format:
/* XPM */ static char * name[] = { /* width height ncolors chars_per_pixel */ "64 64 -4 1 ", /* colormap */ "\ \x50\x50\x80\ .\xff\xff\x00\ r\xff\x00\x00\ b\x00\x00\x00", /* pixels */ " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", " bb............................................bb ", ...
All lines starting with "/*" are optional. Parsers should handle '\' at the end of the line and \xNN and \NNN characters. This requires the C compiler to parse \xNN characters.