SDL_Palette(3)
π SDL_Palette(3) π
okay bestie, welcome to the SDL API Reference β this is the SDL_Palette page and honestly it's short, sweet, and iconic. let's get into it β¨
π NAME π
SDL_Palette β the color palette for 8-bit pixel formats π¨
π§ STRUCTURE DEFINITION π§
here's the whole vibe, literally verbatim:
typedef struct{
int ncolors;
SDL_Color *colors;
} SDL_Palette;
π STRUCTURE DATA π
the two fields, no notes skipped:
ncolorsβ the number of colors used in this palette πcolorsβ a pointer to theSDL_Colorstructures that make up the palette π¦
β¨ DESCRIPTION β¨
so here's the tea, fr fr: every pixel in an 8-bit surface is an index into the colors field of the SDL_Palette structure stored in SDL_PixelFormat.
and like β you should never need to create an SDL_Palette manually. not ever. it gets created automatically when SDL allocates an SDL_PixelFormat for a surface π«Ά
and if you wanna change the colors? the color values of an SDL_Surface's palette can be set with SDL_SetColors. that's the move π
bestie reminder: manual creation is not the assignment here. SDL handles it. you just vibe with the palette it hands you π
π SEE ALSO π
SDL_ColorSDL_SurfaceSDL_SetColorsSDL_SetPalette
k that's the whole page, you ate it π β¨
this lil masterpiece came from the SDL crew, dated Tue 11 Sep 2001, 23:01, and it lives at SDL_Palette(3) β mwah, stan forever ππ¦π
π¦ where this page comes from
- debian bookworm: libsdl1.2-dev 1.2.15+dfsg2-8 Β· LGPL-2.1-or-later
- nixos 26.05: SDL_sixel 0-unstable-2016-02-06
- nixpkgs unstable: SDL_sixel 0-unstable-2016-02-06
- ubuntu jammy: libsdl1.2-dev 1.2.15+dfsg2-6 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms