line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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 module for Apple_Terminal. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SEE ALSO |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
L |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package Getopt::EX::termcolor::Apple_Terminal; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
1243
|
use v5.14; |
|
1
|
|
|
|
|
4
|
|
22
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
23
|
1
|
|
|
1
|
|
4
|
use Data::Dumper; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
6
|
use Getopt::EX::termcolor qw(rgb_to_luminance); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
285
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub get_colors { |
28
|
|
|
|
|
|
|
map { |
29
|
0
|
|
|
0
|
0
|
|
my @rgb = get_color($_); |
|
0
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
@rgb ? undef : [ @rgb ]; |
31
|
|
|
|
|
|
|
} @_; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub get_color { |
35
|
0
|
|
|
0
|
0
|
|
my $cat = lc shift; |
36
|
0
|
0
|
|
|
|
|
if ($cat eq 'background') { |
37
|
0
|
|
|
|
|
|
return background_rgb(); |
38
|
|
|
|
|
|
|
} |
39
|
0
|
|
|
|
|
|
(); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub background_rgb { |
43
|
0
|
|
|
0
|
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
|
0
|
|
|
|
|
@rgb == 3 ? ( { max => 65535 }, @rgb) : (); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__DATA__ |