Text/ANSITable/StyleSet/AltRow.pm

filter: Statementstmt 60.7% 17 / 28 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 2 totaltotal 43.4% 20 / 46 CC 6 SCAR 31.6
CC
6
Cov
45%
__ANON__
42.0
summary
2.0
apply
2.0
CRAP 23.5
« Text/ANSITable.pm ↑ Summary ColorTheme/Text/ANSITable/Standard/Gradation.pm »
1 package Text::ANSITable::StyleSet::AltRow;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 has odd_bgcolor => (is => 'rw');
8 1 has even_bgcolor => (is => 'rw');
9 1 has odd_fgcolor => (is => 'rw');
10 1 has even_fgcolor => (is => 'rw');
11  
12 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
13 1 our $DATE = '2025-02-24'; # DATE
14 1 our $DIST = 'Text-ANSITable'; # DIST
15 1 our $VERSION = '0.610'; # VERSION
16  
17 0 ▶sub summary {
Subroutine summary: not called CC=1 SCAR=6.9
Pod undocumented
18 0 "Set different foreground and/or background color for odd/even rows";
19 }
20  
21 0 ▶sub apply {
Subroutine apply: not called CC=1 SCAR=6.9
Pod undocumented
22 0 my ($self, $table) = @_;
23  
24 $table->add_cond_row_style(
25 0 ▶ sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
26 0 my ($t, %args) = @_;
27 0 my %styles;
28 # because we count from 0
29 0 ▶ if ($_ % 2 == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ % 2 == 0) { } 0 0 0
30 0 ▶ $styles{bgcolor} = $self->odd_bgcolor
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->odd_bgcolor 0 0 0
31 if defined $self->odd_bgcolor;
32 0 ▶ $styles{fgcolor}=$self->odd_fgcolor
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->odd_fgcolor 0 0 0
33 if defined $self->odd_fgcolor;
34 } else {
35 0 ▶ $styles{bgcolor} = $self->even_bgcolor
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->even_bgcolor 0 0 0
36 if defined $self->even_bgcolor;
37 0 ▶ $styles{fgcolor} = $self->even_fgcolor
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->even_fgcolor 0 0 0
38 if defined $self->even_fgcolor;
39 }
40 0 \%styles;
41 },
42 0 );
43 }
44  
45 1 1;
46  
47 # ABSTRACT: Set different foreground and/or background color for odd/even rows";
48  
49 __END__
« Text/ANSITable.pm ↑ Summary ColorTheme/Text/ANSITable/Standard/Gradation.pm »