blib/lib/ANSI/Palette.pm

filter: Statementstmt 53.7% 43 / 80 Branchbran 31.2% 5 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 59.3% 19 / 32 Podpod 92.8% 26 / 28 totaltotal 59.6% 93 / 156 CC 14 SCAR 13.2
CC
14
Cov
50%
palette_16
12.0
palette_256
12.0
palette_8
6.0
CRAP 3.7
↑ Summary
1 package ANSI::Palette;
2 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 our $VERSION = '0.06';
6 2 ▶use base 'Import::Export';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 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 0 ▶sub palette_8 {
Subroutine palette_8: not called CC=2 SCAR=17.9
Pod documented
41 0 print "ANSI palette -> \\e[Nm\n";
42 0 for (30..37) {
43 0 print "\e[" . $_ . "m " . $_;
44 }
45 0 reset;
46 }
47  
48 0 ▶sub palette_16 {
Subroutine palette_16: not called CC=3 SCAR=24.8
Pod documented
49 0 print "ANSI palette -> \\e[Nm\n";
50 0 for (30..37) {
51 0 print "\e[" . $_ . "m " . $_;
52 }
53 0 print "\nANSI palette -> \\e[N;1m\n";
54 0 for (30..37) {
55 0 print "\e[" . $_ . ";1m " . $_;
56 }
57 0 reset;
58 }
59  
60 0 ▶sub palette_256 {
Subroutine palette_256: not called CC=3 SCAR=24.8
Pod documented
61 0 print "ANSI palette -> \\e[38;5;Nm\n";
62 0 for my $i (0..15) {
63 0 for my $j (0..16) {
64 0 my $code = $i * 16 + $j;
65 0 print "\e[38;5;" . $code . "m " . $code;
66 }
67 0 print "\n";
68 }
69 0 reset;
70 }
71  
72 1 ▶sub text_8 {
Subroutine text_8: called CC=1 SCAR=0.0
Pod documented
73 1 print "\e[" . $_[0] . "m" . $_[1];
74 1 reset();
75 }
76  
77 1 ▶sub text_16 {
Subroutine text_16: called CC=2 SCAR=7.2
Pod documented
78 1 ▶ print "\e[" . $_[0] . ($_[1] ? ";1" : "") . "m" . $_[2];
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 1 0 1
79 1 reset();
80 }
81  
82 1 ▶sub text_256 {
Subroutine text_256: called CC=1 SCAR=0.0
Pod documented
83 1 print "\e[38;5;" . $_[0] . "m" . $_[1];
84 1 reset();
85 }
86  
87 1 ▶sub bold_8 {
Subroutine bold_8: called CC=1 SCAR=0.0
Pod documented
88 1 print "\e[" . $_[0] . ";1m" . $_[1];
89 1 reset();
90 }
91  
92 0 ▶sub bold_16 {
Subroutine bold_16: not called CC=2 SCAR=17.9
Pod documented
93 0 ▶ print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";1m" . $_[2];
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 0 0 0
94 0 reset();
95 }
96  
97 0 ▶sub bold_256 {
Subroutine bold_256: not called CC=1 SCAR=6.9
Pod documented
98 0 print "\e[38;5;" . $_[0] . ";1m" . $_[1];
99 0 reset();
100 }
101  
102 1 ▶sub underline_8 {
Subroutine underline_8: called CC=1 SCAR=0.0
Pod documented
103 1 print "\e[" . $_[0] . ";4m" . $_[1];
104 1 reset();
105 }
106  
107 0 ▶sub underline_16 {
Subroutine underline_16: not called CC=2 SCAR=17.9
Pod documented
108 0 ▶ print "\e[" . $_[0] . ($_[1] ? ";1" : "") . ";4m" . $_[2];
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 0 0 0
109 0 reset();
110 }
111  
112 0 ▶sub underline_256 {
Subroutine underline_256: not called CC=1 SCAR=6.9
Pod documented
113 0 print "\e[38;5;" . $_[0] . ";4m" . $_[1];
114 0 reset();
115 }
116  
117 1 ▶sub italic_8 {
Subroutine italic_8: called CC=1 SCAR=0.0
Pod documented
118 1 print "\e[" . $_[0] . ";3m" . $_[1];
119 1 reset();
120 }
121  
122 0 ▶sub italic_16 {
Subroutine italic_16: not called CC=2 SCAR=17.9
Pod documented
123 0 ▶ print "\e[" . $_[0] . ($_[1] ? ";1" : "") . ";3m" . $_[2];
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 0 0 0
124 0 reset();
125 }
126  
127 0 ▶sub italic_256 {
Subroutine italic_256: not called CC=1 SCAR=6.9
Pod documented
128 0 print "\e[38;5;" . $_[0] . ";3m" . $_[1];
129 0 reset();
130 }
131  
132 1 ▶sub background_text_8 {
Subroutine background_text_8: called CC=1 SCAR=0.0
Pod documented
133 1 print "\e[" . $_[0] . ";" . $_[1] . "m" . $_[2];
134 1 reset();
135 }
136  
137 1 ▶sub background_text_16 {
Subroutine background_text_16: called CC=2 SCAR=7.2
Pod documented
138 1 ▶ print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";" . $_[2] . "m" . $_[3];
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 0 1 1
139 1 reset();
140 }
141  
142 1 ▶sub background_text_256 {
Subroutine background_text_256: called CC=1 SCAR=0.0
Pod documented
143 1 print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . "m" . $_[2];
144 1 reset();
145 }
146  
147 0 ▶sub background_bold_8 {
Subroutine background_bold_8: not called CC=1 SCAR=6.9
Pod documented
148 0 print "\e[" . $_[0] . ";" . $_[1] . ";1m" . $_[2];
149 0 reset();
150 }
151  
152 1 ▶sub background_bold_16 {
Subroutine background_bold_16: called CC=2 SCAR=7.2
Pod documented
153 1 ▶ print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";" . $_[2] . ";1m" . $_[3];
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 0 1 1
154 1 reset();
155 }
156  
157 1 ▶sub background_bold_256 {
Subroutine background_bold_256: called CC=1 SCAR=0.0
Pod documented
158 1 print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";1m" . $_[2];
159 1 reset();
160 }
161  
162 0 ▶sub background_underline_8 {
Subroutine background_underline_8: not called CC=1 SCAR=6.9
Pod documented
163 0 print "\e[" . $_[0] . ";" . $_[1] . ";4m" . $_[2];
164 0 reset();
165 }
166  
167 1 ▶sub background_underline_16 {
Subroutine background_underline_16: called CC=2 SCAR=7.2
Pod documented
168 1 ▶ print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ';' . $_[2] . ";4m" . $_[3];
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 0 1 1
169 1 reset();
170 }
171  
172 1 ▶sub background_underline_256 {
Subroutine background_underline_256: called CC=1 SCAR=0.0
Pod documented
173 1 print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";4m" . $_[2];
174 1 reset();
175 }
176  
177 0 ▶sub background_italic_8 {
Subroutine background_italic_8: not called CC=1 SCAR=6.9
Pod documented
178 0 print "\e[" . $_[0] . ";" . $_[1] . ";3m" . $_[2];
179 0 reset();
180 }
181  
182 1 ▶sub background_italic_16 {
Subroutine background_italic_16: called CC=2 SCAR=7.2
Pod undocumented
183 1 ▶ print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";" . $_[2] . ";3m" . $_[3];
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 0 1 1
184 1 reset();
185 }
186  
187 1 ▶sub background_italic_256 {
Subroutine background_italic_256: called CC=1 SCAR=0.0
Pod undocumented
188 1 print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";3m" . $_[2];
189 1 reset();
190 }
191  
192 0 ▶sub reset { print "\e[0m"; }
Subroutine reset: not called CC=1 SCAR=6.9
Pod documented
193  
194 __END__
↑ Summary