Colouring-In-XS
view release on metacpan or search on metacpan
lib/Colouring/In/XS.pm view on Meta::CPAN
=head2 toHSV
Returns an opaque colour string from hue, saturation and value (HSV) values.
my $string = $colour->toHSV;
=cut
=head2 toTerm
Returns an opaque colour string from decimal red, green and blue (RGB) values
valid for Term::ANSIColor foreground content.
my $string = $colour->toTerm;
=head2 toOnTerm
Returns an opaque colour string from decimal red, green and blue (RGB) values
valid for Term::ANSIColor background content.
my $string = $colour->toOnTerm;
=head2 colour
Returns an array containeing the red, green and blue (RGB) values.
my $string = $colour->colour;
=cut
=head2 validate
Validate that the passed colour is a color.
my $valid = $colour->validate('#abc'); # valid
my $invalid = $colour->validate('#xyz'); # invalid
=cut
=head1 BENCHMARK
use Benchmark qw(:all);
use Colouring::In;
use Colouring::In::XS;
timethese(1000000, {
'Colouring::In' => sub {
my $start = '#ffffff';
my $colour = Colouring::In->new($start);
$colour->toRGB();
},
'XS' => sub {
my $start = '#ffffff';
my $colour = Colouring::In::XS->new($start);
$colour->toRGB();
}
});
...
Benchmark: timing 1000000 iterations of Colouring::In, XS...
Colouring::In: 13 wallclock secs (12.36 usr + 0.00 sys = 12.36 CPU) @ 80906.15/s (n=1000000)
XS: 0 wallclock secs ( 0.59 usr + 0.01 sys = 0.60 CPU) @ 1666666.67/s (n=1000000)
=head1 AUTHOR
LNATION, C<< <email at lnation.org> >>
=head1 BUGS
Please report any bugs or feature requests to C<bug-colouring-in-xs at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Colouring-In-XS>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Colouring::In::XS
You can also look for information at:
=over 2
=item * RT: CPAN's request tracker (report bugs here)
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Colouring-In-XS>
=item * Search CPAN
L<https://metacpan.org/release/Colouring-In-XS>
=back
=head1 ACKNOWLEDGEMENTS
=head1 LICENSE AND COPYRIGHT
This software is Copyright (c) 2024->2026 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
=cut
1; # End of Colouring::In::XS
( run in 1.057 second using v1.01-cache-2.11-cpan-96521ef73a4 )