#!/usr/bin/perl

use 5.010;
use strict;
use warnings;

use Text::ANSITable;

our $VERSION = '0.18'; # VERSION

binmode(STDOUT, ":utf8");

my $t = Text::ANSITable->new;
my $all_ct = $t->list_color_themes(1);

my $chosen_ct = $ARGV[0] // $t->{color_theme}{name};

$t->columns(['Name', 'Summary']);
for my $name (sort keys %$all_ct) {
    my $ct = $all_ct->{$name};
    my $selected = $chosen_ct eq $name;

    $t->add_row([$name . ($selected ? " (*)" : ""), $ct->{summary}],
                {fgcolor=>($selected ? 'aaaa00' : undef)});
}

say "Tip: you can run me with color theme name as argument to try it out.";
print $t->draw;

require DateTime;

$t = Text::ANSITable->new;
$t->color_theme($chosen_ct);
my $ct = $t->color_theme;
$t->columns(['num','percent%','date','bool?','text']);
$t->add_row([1, 0.4, DateTime->now, 1, 'hello']);
$t->add_row([-3.3, 1, time(), 0, 'world']);
$t->add_row_separator;
$t->add_row([$_, $_/10, 1367451584+$_*10000, int(rand()*2), "x$_"])
    for 1..5;

say "Demo table";
print $t->draw;

#ABSTRACT: List available color themes for Text::ANSITable
#PODNAME: ansitable-list-color-themes

__END__

=pod

=encoding utf-8

=head1 NAME

ansitable-list-color-themes - List available color themes for Text::ANSITable

=head1 VERSION

version 0.18

=head1 AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Steven Haryanto.

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

=cut
