line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ANSI::Palette; |
2
|
2
|
|
|
2
|
|
137374
|
use 5.006; |
|
2
|
|
|
|
|
16
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
57
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
97
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
2
|
|
|
2
|
|
16
|
use base 'Import::Export'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1100
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our %EX = ( |
9
|
|
|
|
|
|
|
reset => [qw/all/], |
10
|
|
|
|
|
|
|
palette_8 => [qw/all/], |
11
|
|
|
|
|
|
|
palette_16 => [qw/all/], |
12
|
|
|
|
|
|
|
palette_256 => [qw/all/], |
13
|
|
|
|
|
|
|
text_8 => [qw/all text ansi_8/], |
14
|
|
|
|
|
|
|
text_16 => [qw/all text ansi_16/], |
15
|
|
|
|
|
|
|
text_256 => [qw/all text ansi_256/], |
16
|
|
|
|
|
|
|
bold_8 => [qw/all bold ansi_8/], |
17
|
|
|
|
|
|
|
bold_16 => [qw/all bold ansi_16/], |
18
|
|
|
|
|
|
|
bold_256 => [qw/all bold ansi_256/], |
19
|
|
|
|
|
|
|
underline_8 => [qw/all underline ansi_8/], |
20
|
|
|
|
|
|
|
underline_16 => [qw/all underline ansi_16/], |
21
|
|
|
|
|
|
|
underline_256 => [qw/all underline ansi_256/], |
22
|
|
|
|
|
|
|
italic_8 => [qw/all italic ansi_8/], |
23
|
|
|
|
|
|
|
italic_16 => [qw/all italic ansi_16/], |
24
|
|
|
|
|
|
|
italic_256 => [qw/all italic ansi_256/], |
25
|
|
|
|
|
|
|
background_text_8 => [qw/all background_text ansi_8/], |
26
|
|
|
|
|
|
|
background_text_16 => [qw/all background_text ansi_16/], |
27
|
|
|
|
|
|
|
background_text_256 => [qw/all background_text ansi_256/], |
28
|
|
|
|
|
|
|
background_bold_8 => [qw/all background_bold ansi_8/], |
29
|
|
|
|
|
|
|
background_bold_16 => [qw/all background_bold ansi_16/], |
30
|
|
|
|
|
|
|
background_bold_256 => [qw/all background_bold ansi_256/], |
31
|
|
|
|
|
|
|
background_underline_8 => [qw/all background_underline ansi_8/], |
32
|
|
|
|
|
|
|
background_underline_16 => [qw/all background_underline ansi_16/], |
33
|
|
|
|
|
|
|
background_underline_256 => [qw/all background_underline ansi_256/], |
34
|
|
|
|
|
|
|
background_italic_8 => [qw/all background_italic ansi_8/], |
35
|
|
|
|
|
|
|
background_italic_16 => [qw/all background_italic ansi_16/], |
36
|
|
|
|
|
|
|
background_italic_256 => [qw/all background_italic ansi_256/], |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub palette_8 { |
41
|
0
|
|
|
0
|
1
|
0
|
print "ANSI palette -> \\e[Nm\n"; |
42
|
0
|
|
|
|
|
0
|
for (30..37) { |
43
|
0
|
|
|
|
|
0
|
print "\e[" . $_ . "m " . $_; |
44
|
|
|
|
|
|
|
} |
45
|
0
|
|
|
|
|
0
|
reset; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub palette_16 { |
49
|
0
|
|
|
0
|
1
|
0
|
print "ANSI palette -> \\e[Nm\n"; |
50
|
0
|
|
|
|
|
0
|
for (30..37) { |
51
|
0
|
|
|
|
|
0
|
print "\e[" . $_ . "m " . $_; |
52
|
|
|
|
|
|
|
} |
53
|
0
|
|
|
|
|
0
|
print "\nANSI palette -> \\e[N;1m\n"; |
54
|
0
|
|
|
|
|
0
|
for (30..37) { |
55
|
0
|
|
|
|
|
0
|
print "\e[" . $_ . ";1m " . $_; |
56
|
|
|
|
|
|
|
} |
57
|
0
|
|
|
|
|
0
|
reset; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub palette_256 { |
61
|
0
|
|
|
0
|
1
|
0
|
print "ANSI palette -> \\e[38;5;Nm\n"; |
62
|
0
|
|
|
|
|
0
|
for my $i (0..15) { |
63
|
0
|
|
|
|
|
0
|
for my $j (0..16) { |
64
|
0
|
|
|
|
|
0
|
my $code = $i * 16 + $j; |
65
|
0
|
|
|
|
|
0
|
print "\e[38;5;" . $code . "m " . $code; |
66
|
|
|
|
|
|
|
} |
67
|
0
|
|
|
|
|
0
|
print "\n"; |
68
|
|
|
|
|
|
|
} |
69
|
0
|
|
|
|
|
0
|
reset; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub text_8 { |
73
|
1
|
|
|
1
|
1
|
150
|
print "\e[" . $_[0] . "m" . $_[1]; |
74
|
1
|
|
|
|
|
6
|
reset(); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub text_16 { |
78
|
1
|
50
|
|
1
|
1
|
18
|
print "\e[" . $_[0] . ($_[1] ? ";1" : "") . "m" . $_[2]; |
79
|
1
|
|
|
|
|
4
|
reset(); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub text_256 { |
83
|
1
|
|
|
1
|
1
|
11
|
print "\e[38;5;" . $_[0] . "m" . $_[1]; |
84
|
1
|
|
|
|
|
4
|
reset(); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub bold_8 { |
88
|
1
|
|
|
1
|
1
|
11
|
print "\e[" . $_[0] . ";1m" . $_[1]; |
89
|
1
|
|
|
|
|
3
|
reset(); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub bold_16 { |
93
|
0
|
0
|
|
0
|
1
|
0
|
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";1m" . $_[2]; |
94
|
0
|
|
|
|
|
0
|
reset(); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub bold_256 { |
98
|
0
|
|
|
0
|
1
|
0
|
print "\e[38;5;" . $_[0] . ";1m" . $_[1]; |
99
|
0
|
|
|
|
|
0
|
reset(); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub underline_8 { |
103
|
1
|
|
|
1
|
1
|
10
|
print "\e[" . $_[0] . ";4m" . $_[1]; |
104
|
1
|
|
|
|
|
4
|
reset(); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub underline_16 { |
108
|
0
|
0
|
|
0
|
1
|
0
|
print "\e[" . $_[0] . ($_[1] ? ";1" : "") . ";4m" . $_[2]; |
109
|
0
|
|
|
|
|
0
|
reset(); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub underline_256 { |
113
|
0
|
|
|
0
|
1
|
0
|
print "\e[38;5;" . $_[0] . ";4m" . $_[1]; |
114
|
0
|
|
|
|
|
0
|
reset(); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub italic_8 { |
118
|
1
|
|
|
1
|
1
|
11
|
print "\e[" . $_[0] . ";3m" . $_[1]; |
119
|
1
|
|
|
|
|
4
|
reset(); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub italic_16 { |
123
|
0
|
0
|
|
0
|
1
|
0
|
print "\e[" . $_[0] . ($_[1] ? ";1" : "") . ";3m" . $_[2]; |
124
|
0
|
|
|
|
|
0
|
reset(); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub italic_256 { |
128
|
0
|
|
|
0
|
1
|
0
|
print "\e[38;5;" . $_[0] . ";3m" . $_[1]; |
129
|
0
|
|
|
|
|
0
|
reset(); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub background_text_8 { |
133
|
0
|
|
|
0
|
1
|
0
|
print "\e[" . $_[0] . ";" . $_[1] . "m" . $_[2]; |
134
|
0
|
|
|
|
|
0
|
reset(); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub background_text_16 { |
138
|
0
|
0
|
|
0
|
1
|
0
|
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . $_[2] . ($_[3] ? ";1" : ";0"). "m" . $_[4]; |
|
|
0
|
|
|
|
|
|
139
|
0
|
|
|
|
|
0
|
reset(); |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub background_text_256 { |
143
|
1
|
|
|
1
|
1
|
12
|
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . "m" . $_[2]; |
144
|
1
|
|
|
|
|
3
|
reset(); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub background_bold_8 { |
148
|
0
|
|
|
0
|
1
|
0
|
print "\e[" . $_[0] . ";" . $_[1] . ";1m" . $_[2]; |
149
|
0
|
|
|
|
|
0
|
reset(); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub background_bold_16 { |
153
|
0
|
0
|
|
0
|
1
|
0
|
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . $_[2] . ($_[3] ? ";1" : ";0") . ";1m" . $_[4]; |
|
|
0
|
|
|
|
|
|
154
|
0
|
|
|
|
|
0
|
reset(); |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub background_bold_256 { |
158
|
1
|
|
|
1
|
1
|
11
|
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";1m" . $_[2]; |
159
|
1
|
|
|
|
|
4
|
reset(); |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub background_underline_8 { |
164
|
0
|
|
|
0
|
1
|
0
|
print "\e[" . $_[0] . ";" . $_[1] . ";4m" . $_[2]; |
165
|
0
|
|
|
|
|
0
|
reset(); |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub background_underline_16 { |
169
|
0
|
0
|
|
0
|
1
|
0
|
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . $_[2] . ($_[3] ? ";1" : ";0") . ";4m" . $_[4]; |
|
|
0
|
|
|
|
|
|
170
|
0
|
|
|
|
|
0
|
reset(); |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub background_underline_256 { |
174
|
1
|
|
|
1
|
1
|
13
|
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";4m" . $_[2]; |
175
|
1
|
|
|
|
|
4
|
reset(); |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub background_italic_8 { |
179
|
0
|
|
|
0
|
1
|
0
|
print "\e[" . $_[0] . ";" . $_[1] . ";3m" . $_[2]; |
180
|
0
|
|
|
|
|
0
|
reset(); |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub background_italic_16 { |
184
|
0
|
0
|
|
0
|
1
|
0
|
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . $_[2] . ($_[3] ? ";1" : ";0") . ";3m" . $_[4]; |
|
|
0
|
|
|
|
|
|
185
|
0
|
|
|
|
|
0
|
reset(); |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub background_italic_256 { |
189
|
1
|
|
|
1
|
1
|
13
|
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";3m" . $_[2]; |
190
|
1
|
|
|
|
|
3
|
reset(); |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
0
|
|
|
0
|
1
|
|
sub reset { print "\e[0m"; } |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
__END__ |