Created
September 18, 2012 17:13
-
-
Save skaji/3744382 to your computer and use it in GitHub Desktop.
terminal color test
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my @block = (0, 30, 40, 90, 100); | |
my @index = 0 .. 7; | |
for my $num1 (map { my $b = $_; map { $b + $_ } @index; } @block) { | |
for my $i (@index) { | |
for my $b (@block) { | |
printf '%3d,%3d:', $num1, $b + $i; | |
print color($num1, $b + $i, 'hello'); | |
print ' '; | |
} | |
print "\n"; | |
} | |
} | |
help(); | |
sub color { | |
my ($num1, $num2, $str) = @_; | |
return "\e[$num1;" . $num2 . "m" . $str . "\e[m"; | |
} | |
sub help { | |
print q{ex: echo "\\e[1;31mABCDEFG\\e[m"}, "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment