| 1 | =head1 NAME | ||||||||||
| 2 | |||||||||||
| 3 | Getopt::EX::termcolor::Apple_Terminal | ||||||||||
| 4 | |||||||||||
| 5 | =head1 SYNOPSIS | ||||||||||
| 6 | |||||||||||
| 7 | command -Mtermcolor::Apple_Terminal | ||||||||||
| 8 | |||||||||||
| 9 | =head1 DESCRIPTION | ||||||||||
| 10 | |||||||||||
| 11 | This is a L<Getopt::EX::termcolor> module for Apple_Terminal. | ||||||||||
| 12 | |||||||||||
| 13 | =head1 SEE ALSO | ||||||||||
| 14 | |||||||||||
| 15 | L<Getopt::EX::termcolor> | ||||||||||
| 16 | |||||||||||
| 17 | =cut | ||||||||||
| 18 | |||||||||||
| 19 | package Getopt::EX::termcolor::Apple_Terminal; | ||||||||||
| 20 | |||||||||||
| 21 | 1 | ▶ | use v5.14; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 1 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | |||||||||||
| 25 | 1 | ▶ | use Getopt::EX::termcolor qw(rgb_to_luminance); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | sub get_colors { | ||||||||
|
Subroutine
get_colors: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 28 | map { | ||||||||||
| 29 | 0 | my @rgb = get_color($_); | |||||||||
| 30 | 0 | ▶ | @rgb ? undef : [ @rgb ]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | } @_; | ||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | sub get_color { | ||||||||
|
Subroutine
get_color: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 35 | 0 | my $cat = lc shift; | |||||||||
| 36 | 0 | ▶ | if ($cat eq 'background') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | return background_rgb(); | |||||||||
| 38 | } | ||||||||||
| 39 | 0 | (); | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | sub background_rgb { | ||||||||
|
Subroutine
background_rgb: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 43 | 0 | my $app = "Terminal"; | |||||||||
| 44 | 0 | my $do = "background color of first window"; | |||||||||
| 45 | 0 | my $bg = qx{osascript -e \'tell application \"$app\" to $do\'}; | |||||||||
| 46 | 0 | my @rgb = $bg =~ /(\d+)/g; | |||||||||
| 47 | 0 | ▶ | @rgb == 3 ? ( { max => 65535 }, @rgb) : (); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 1 | 1; | |||||||||
| 51 | |||||||||||
| 52 | __DATA__ | ||||||||||