line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Getopt::EX::autocolor::Apple_Terminal |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
command -Mautocolor::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::autocolor::Apple_Terminal; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
1236
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
22
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
23
|
1
|
|
|
1
|
|
5
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
6
|
use Getopt::EX::autocolor qw(rgb_to_brightness); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
231
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub rgb { |
28
|
0
|
|
|
0
|
0
|
|
my $app = "Terminal"; |
29
|
0
|
|
|
|
|
|
my $do = "background color of first window"; |
30
|
0
|
|
|
|
|
|
my $bg = qx{osascript -e \'tell application \"$app\" to $do\'}; |
31
|
0
|
|
|
|
|
|
$bg =~ /(\d+)/g; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub brightness { |
35
|
0
|
|
|
0
|
0
|
|
my(@rgb) = rgb; |
36
|
0
|
0
|
|
|
|
|
@rgb == 3 or return undef; |
37
|
0
|
0
|
|
|
|
|
if (grep { not /^\d+$/ } @rgb) { |
|
0
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
undef; |
39
|
|
|
|
|
|
|
} else { |
40
|
0
|
|
|
|
|
|
rgb_to_brightness @rgb; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__DATA__ |