App-colorcoke
view release on metacpan or search on metacpan
bin/colorcoke view on Meta::CPAN
use Getopt::Long;
use Pod::Usage;
use Term::ExtendedColor qw(fg bg);
use Term::ExtendedColor::Xresources qw(set_xterm_color);
my $DEBUG = $ENV{DEBUG};
our($opt_r_step, $opt_g_step, $opt_b_step) = (10) x 3;
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 = ();
bin/colorcoke view on Meta::CPAN
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,
bin/colorcoke view on Meta::CPAN
sub make_shade {
my @tint = ();
my ($r, $g, $b) = $opt_hex =~ /(..)(..)(..)/; #FIXME
$r = hex($r);
$g = hex($g);
$b = hex($b);
$opt_starting_point = 0 if($opt_starting_point == 1); # Include ANSI
$opt_endpoint = 255 if($opt_endpoint == 1); # Include greyscale
if($opt_ansi_only) {
$opt_starting_point = 0;
$opt_endpoint = 16;
}
for ($opt_starting_point .. $opt_endpoint) {
if($opt_random) {
$r = int(rand($opt_random_r) % 256);
$g = int(rand($opt_random_g) % 256);
$b = int(rand($opt_random_b) % 256);
}
$r = (($r + $opt_r_step) < (256 - ($opt_r_step + $r)))
( run in 0.235 second using v1.01-cache-2.11-cpan-b61123c0432 )