App-colorcoke
view release on metacpan or search on metacpan
bin/colorcoke view on Meta::CPAN
our $opt_hex = '000000';
our $opt_starting_point = 17; # Start from 17
our $opt_endpoint = 231; # End at 231
our $opt_ansi_only = 0;
our $opt_random = 0;
our $opt_random_r = 256;
our $opt_random_g = 256;
our $opt_random_b = 256;
our $opt_single_hex = 0;
our @opt_single_color = ();
#our @opt_do_not_modify = (0,7,15,232);
our @opt_do_not_modify = ();
if(!@ARGV) {
print "$APP $VERSION\n\n";
pod2usage(verbose => 1);
}
GetOptions(
'c|color:s' => \$opt_hex,
'r|red:i' => \$opt_r_step,
'g|green:i' => \$opt_g_step,
'b|blue:i' => \$opt_b_step,
'1|single:s{2}' => \@opt_single_color,
's|start:i' => \$opt_starting_point,
'end:i' => \$opt_endpoint,
'ansi' => \$opt_ansi_only,
'random' => \$opt_random,
'rr|rand-red:i' => \$opt_random_r,
'rg|rand-green:i' => \$opt_random_g,
'rb|rand-blue:i' => \$opt_random_b,
'no:i{1,}' => \@opt_do_not_modify,
'h|help' => sub { print "$APP $VERSION\n"; pod2usage(verbose => 1) },
'm|man' => sub { pod2usage(verbose => 3) and exit(0); },
'v|version' => sub { print "$APP v$VERSION\n" and exit(0); },
'debug' => \$DEBUG,
);
if(scalar(@opt_single_color) == 2) {
set_single_color({ @opt_single_color });
exit(0);
}
bin/colorcoke view on Meta::CPAN
print values %{ set_xterm_color( $index_to_hex ) };
}
sub set_shade {
my @colors = @_;
my $i = $opt_starting_point;
for my $color(@colors) {
unless($i ~~ @opt_do_not_modify) {
$color = substr($color, 0, 6);
print for values %{ set_xterm_color({ $i => $color }) };
if(($i +1) % 10 == 0) {
print bg($i, fg(0, sprintf(" %03d ", $i))), "\n";
}
else {
print bg($i, fg(0, sprintf(" %03d ", $i)));
}
}
$i++;
( run in 7.059 seconds using v1.01-cache-2.11-cpan-5837b0d9d2c )