pods::...alette(3pm)
β¨ NAME β¨
okay so this page is pods::...alette(3pm) β from the User Contributed Perl Documentation, bestie, we love a community-contributed moment π β and it's literally all about SDL::Palette -- Color palette for 8-bit pixel formats. that's the whole vibe. a palette. for 8-bit pixels. slay.
π CATEGORY π
Core, Video, Structure β yes queen, core AND video AND structure, she contains multitudes π
πΈ DESCRIPTION πΈ
okay so picture this: every single pixel in an 8-bit surface isn't a color at all, it's an index β a little number that points into the colors field of the SDL::Palette object that's stored in its SDL::PixelFormat. like a lookup table but make it fashion π¦
and here's the cute part: a SDL::Palette gets created automatically when SDL allocates a SDL::PixelFormat for a surface. you don't have to do a thing. main character energy, honestly, she just shows up π₯
this class has the methods for returning the colors in a palette object, which is literally the whole point. and if you wanna set the colors? that's not here, bestie β the colors can be set with SDL::Video::set_colors and SDL::Video::set_palette. iykyk π«Ά
π METHODS π
β ncolors
$ncolors = $palette->ncolors();
returns the number of colors in palette. that's it. that's the method. no notes π
π colors
@colors = @{ $palette->colors() };
returns an array β ncolors in length, so like, exactly as long as the palette is big β of the SDL::Colors in the palette. the way that it hands you the whole list at onceβ¦ obsessed β¨
π¦ color_index
$color = $palette->color_index( $index );
returns the SDL::Color at the provided index of the palette. very "you give me a number, i give you a color" of her. iconic π
π SEE ALSO π
SDL::VideoSDL::PixelFormatSDL::ColorSDL::Surface
go read those too, bestie, they're all in the same friend group fr fr π«Ά
π AUTHORS π
See "AUTHORS" in SDL. that's the whole author section, no cap π
ok that's the page!! go forth and palette, you've got this π
β¨ππ sign-off time ππβ¨ β this little masterpiece is perl v5.42.3, dated 2026-08-19, and it's page pods::...alette(3pm). no cap, remember the version and the date, she's got receipts ππΈ
π¦ where this page comes from
- ubuntu stonking: libsdl-perl 2.548-6build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms