Add a custom entry for color palettes
Fix setting custom colors in palette

 * There was an error in the way the index
   was computed.
 * Fixes #18