#!/usr/bin/perl
use strict;
use Term::ExtendedColor qw(fg bg get_colors);

my $colors = get_colors();

my @sorted_colors;

# We want to sort by 001 .. 010 .. 042
for my $color(keys(%{$colors})) {
  $color =~ m/(\d+)$/;
  my $num = sprintf("%03d", $1);
  $color =~ s/(\d+)$/$num/;
  push(@sorted_colors, $color);
}

for(sort(@sorted_colors)) {
  s/([a-z]+)0+(\d+)$/$1$2/;
  print bg($_, "  x  "), "\t";
  print fg($_, $_), "\n";
}


__END__


=pod

=head1 NAME

show_all_colors - show all available colors from Term::ExtendedColor, in color

=head1 USAGE

  show_all_colors

=head1 DESCRIPTION

B<show_all_colors> prints a list with all available color and attribute names
that might be used with L<Term::ExtendedColor>.

=head1 REPORTING BUGS

Report bugs and/or feature requests on rt.cpan.org, the repository issue tracker
or directly to L<magnus@trapd00r.se>

=head1 AUTHOR

  Magnus Woldrich
  CPAN ID: WOLDRICH
  magnus@trapd00r.se
  http://japh.se

=head1 CONTRIBUTORS

None required yet.

=head1 COPYRIGHT

Copyright 2011 B<THIS APPLICATION>s L</AUTHOR> and L</CONTRIBUTORS> as listed
above.

=head1 LICENSE

This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=head1 SEE ALSO

=cut

# vim: set ts=2 et sw=2:
