| 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
| |||||||||||
| 30 | 0 | ▶ | $styles{bgcolor} = $self->odd_bgcolor | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | if defined $self->odd_bgcolor; | ||||||||||
| 32 | 0 | ▶ | $styles{fgcolor}=$self->odd_fgcolor | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | if defined $self->odd_fgcolor; | ||||||||||
| 34 | } else { | ||||||||||
| 35 | 0 | ▶ | $styles{bgcolor} = $self->even_bgcolor | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | if defined $self->even_bgcolor; | ||||||||||
| 37 | 0 | ▶ | $styles{fgcolor} = $self->even_fgcolor | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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__ | ||||||||||