# Loading .PAL files

**URL:** <https://discourse.libsdl.org/t/loading-pal-files/11093>\
**Category:** SDL Development\
**Created:** [July 27, 2004, 10:57pm UTC](https://discourse.libsdl.org/t/loading-pal-files/11093 "2004-07-27T22:57:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wperone\_at\_digipen.e](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/w/5fc32e/32.png) [@wperone\_at\_digipen.e](https://discourse.libsdl.org/u/wperone_at_digipen.e)\
**Post date:** [July 27, 2004, 10:57pm UTC](https://discourse.libsdl.org/t/loading-pal-files/11093/1 "2004-07-27T22:57:21Z")

</div>

I wrote an addon so that SDL can support loading microsoft .PAL palette  
files into an SDL\_Palette, the functions work just like SDL\_LoadBMP. I  
figured many developers who write palettized sprite games might appreciate  
this since then they can divorce their palettes from their images. It  
would be cool if it was put in the next release of SDL.  
I have documentation on how to do it in C++ here:  
[http://home.comcast.net/~willperone/Codetips/readingpal.html](http://home.comcast.net/~willperone/Codetips/readingpal.html)

And my SDL addon is here (it’s coded in SDL compliant C):  
[http://home.comcast.net/~willperone/Code/SDL\_Pal.zip](http://home.comcast.net/~willperone/Code/SDL_Pal.zip)

- Will

---

<div class="post-metadata">

**Author:** ![Donny\_Viszneki](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/donny_viszneki/32/360_2.png) [@Donny\_Viszneki](https://discourse.libsdl.org/u/Donny_Viszneki)\
**Post date:** [July 28, 2004, 12:19pm UTC](https://discourse.libsdl.org/t/loading-pal-files/11093/2 "2004-07-28T12:19:35Z")

</div>

That would be very useful, if it weren’t for the fact that any  
color-paletted game out there will (or should) have created all of  
their sprites USING the palette they intend on ultimately using in  
their game, and it’s currently very easy in SDL to set the color  
palette according to the palette of an image loaded from disk.On Jul 27, 2004, at 6:57 PM, wrote:

> I wrote an addon so that SDL can support loading microsoft .PAL palette  
> files into an SDL\_Palette, the functions work just like SDL\_LoadBMP. I  
> figured many developers who write palettized sprite games might  
> appreciate  
> this since then they can divorce their palettes from their images. It  
> would be cool if it was put in the next release of SDL.  
> I have documentation on how to do it in C++ here:  
> [http://home.comcast.net/~willperone/Codetips/readingpal.html](http://home.comcast.net/~willperone/Codetips/readingpal.html)
> 
> And my SDL addon is here (it’s coded in SDL compliant C):  
> [http://home.comcast.net/~willperone/Code/SDL\_Pal.zip](http://home.comcast.net/~willperone/Code/SDL_Pal.zip)
> 
> - Will
> 
> * * *
> 
> SDL mailing list  
> SDL at [libsdl.org](http://libsdl.org)  
> [http://www.libsdl.org/mailman/listinfo/sdl](http://www.libsdl.org/mailman/listinfo/sdl)

- Donny Viszneki

---

<div class="post-metadata">

**Author:** ![wperone\_at\_digipen.e](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/w/5fc32e/32.png) [@wperone\_at\_digipen.e](https://discourse.libsdl.org/u/wperone_at_digipen.e)\
**Post date:** [July 28, 2004, 5:00pm UTC](https://discourse.libsdl.org/t/loading-pal-files/11093/3 "2004-07-28T17:00:06Z")

</div>

> That would be very useful, if it weren’t for the fact that any  
> color-paletted game out there will (or should) have created all of  
> their sprites USING the palette they intend on ultimately using in  
> their game, and it’s currently very easy in SDL to set the color  
> palette according to the palette of an image loaded from disk.

There are many situations where you want to use multiple palettes or do  
palette swapping. Take for example a simple NES megaman style game,  
rather than having a seperate set of images for each color scheme for  
megaman, you just load up a different .PAL file and set the palette.

- Will

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [August 21, 2004, 12:58pm UTC](https://discourse.libsdl.org/t/loading-pal-files/11093/4 "2004-08-21T12:58:17Z")

</div>

> I wrote an addon so that SDL can support loading microsoft .PAL palette  
> files into an SDL\_Palette, the functions work just like SDL\_LoadBMP. I  
> figured many developers who write palettized sprite games might appreciate  
> this since then they can divorce their palettes from their images. It  
> would be cool if it was put in the next release of SDL.  
> I have documentation on how to do it in C++ here:  
> [http://home.comcast.net/~willperone/Codetips/readingpal.html](http://home.comcast.net/~willperone/Codetips/readingpal.html)

> And my SDL addon is here (it’s coded in SDL compliant C):  
> [http://home.comcast.net/~willperone/Code/SDL\_Pal.zip](http://home.comcast.net/~willperone/Code/SDL_Pal.zip)

Go ahead and add this to the SDL demos or libraries page!  
[http://www.libsdl.org/faq.php?action=listentries&category=1#60](http://www.libsdl.org/faq.php?action=listentries&category=1#60)

See ya,  
-Sam Lantinga, Software Engineer, Blizzard Entertainment
