title: How to use palettes in SDL 2
body: <p>I'm updating a program from SDL 1 to SDL 2 and need to use color palettes. Originally, I used <code>SDL_SetColors(screen, color, 0, intColors);</code> but that does't work in SDL 2. I'm trying to use:</p>
  
  <pre><code>SDL_Palette *palette = (SDL_Palette *)malloc(sizeof(color)*intColors);
  SDL_SetPaletteColors(palette, color, 0, intColors);
  SDL_SetSurfacePalette(surface, palette);
  </code></pre>
  
  <p>But <code>SDL_SetPaletteColors()</code> returns -1 and fails. <code>SDL_GetError</code> gives me no information.</p>
  
  <p>How can I make a palette from a <code>SDL_Color</code> and then set it as my surface's palette?</p>