Graphics::Raylib::Color - Use predefined Raylib colors or define your own
=head1 VERSION
version 0.005
=head1 SYNOPSIS
use Graphics::Raylib::Color;
my $color = Graphics::Raylib::Color::BLACK;
# alternatively:
use Graphics::Raylib::Color qw(:all);
my $color2 = MAROON;
my $gray = Graphics::Raylib::Color::rgb(127,127,127);
my $rainbow = Graphics::Raylib::Color::rainbow(colors => 100);
push @colors, $rainbow->cycle for (1..100);
=head1 DESCRIPTION
Colors you can pass to raylib.
=head1 IMPLEMENTATION
As a color is basically a 32-bit integer (RGBA) in raylib, the constructors rgba and rgb do little more packing it into an integer and blessing it. Interpolating a color into a string results in a tuple of the form C<< "(r: %u, g: %u, b: %u, a: %u)" >>.
=head1 METHODS AND ARGUMENTS
=over 4
=item rgba($red, $green, $blue, $alpha)
Constructs a new Graphics::Raylib::Color instance.
=cut
subrgba {
my$self= \pack("C4", @_);
bless$self, 'Color';
return$self;
}
=item rgb($red, $green, $blue)
Constructs a new Graphics::Raylib::Color instance out of an opaque color.
Calls C<rgba> with C<$alpha = 255>.
=cut
subrgb {
rgba(@_, 255);
}
=item ($r, $g, $b, $a) = colors
Returns a list with the red, green, blue and alpha components of the color.
Returns a code reference that cycles through the rainbow colors on each evaluation. C<$color_count> is the total number of colors before bouncing back. Default is C<7>.