Created
December 4, 2011 04:16
-
-
Save syohex/1429142 to your computer and use it in GitHub Desktop.
Example of ansi_color option Text::UnicodeTable::Simple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl | |
use strict; | |
use warnings; | |
use utf8; | |
use Term::ANSIColor qw(:constants); | |
use Term::ExtendedColor qw(:all); | |
use Text::UnicodeTable::Simple; | |
binmode STDOUT, ":utf8"; | |
my $table = Text::UnicodeTable::Simple->new( | |
header => [qw/名前 よみ 生年月日 キャッチフレーズ/], | |
ansi_color => 1, | |
); | |
my @info_by_color = ( | |
purple => [ qw/高城れに たかぎれに 1993年6月21日 感電少女/ ], | |
red1 => [ qw/百田夏菜子 ももたかなこ 1994年7月12日 茶畑のシンデレラ/ ], | |
green1 => [ qw/有安杏果 ありやすももか 1995年3月15日 小さな巨人/ ], | |
yellow1 => [ qw/玉井詩織 たまいしおり 1995年6月4日 みんなの妹/ ], | |
hotpink => [ qw/佐々木彩夏 ささきあやか 1996年6月11日 ももクロのアイドル/ ], | |
); | |
while ( my ($color, $value) = splice @info_by_color, 0, 2 ) { | |
$table->add_row( | |
[ map { fg('bold', fg($color, $_)) } @{$value} ] | |
); | |
} | |
print $table->draw, "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment