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
|
|
1504
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
22
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
33
|
|
23
|
1
|
|
|
1
|
|
4
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
69
|
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
10
|
use Getopt::EX::termcolor qw(rgb_to_luminance); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
249
|
|
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__ |