The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

=pod

=head1 NAME

SDL::Palette -- Color palette for 8-bit pixel formats 

=head1 CATEGORY

Core, Video, Structure

=head1 DESCRIPTION

Each pixel in an 8-bit surface is an index into the colors field of the C<SDL::Palette> object stored in its C<SDL::PixelFormat>.
A C<SDL::Palette> is created automatically when SDL allocates a C<SDL::PixelFormat> for a surface.
This class has methods for returning the colors in a palette object.
The colors can be set with L<SDL::Video::set_colors|SDL::Video/set_colors> and L<SDL::Video::set_palette|SDL::Video/set_palette>.

=head1 METHODS

=head2 ncolors

  $ncolors = $palette->ncolors();

Returns the number of colors in palette.

=head2 colors

  @colors = @{ $palette->colors() };

Returns an array, C<ncolors> in length, of the L<SDL::Color>s in the palette.

=head2 color_index

  $color = $palette->color_index( $index );

Returns the L<SDL::Color> at the provided index of the palette.

=head1 SEE ALSO

L<SDL::Video> L<SDL::PixelFormat> L<SDL::Color> L<SDL::Surface>

=head1 AUTHORS

See L<SDL/AUTHORS>.

=cut