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::Video
  • SDL::PixelFormat
  • SDL::Color
  • SDL::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