| 1 | package ColorThemeBase::Static::FromStructColors; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use strict 'subs', 'vars'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | #use warnings; | ||||||||||
| 5 | |||||||||||
| 6 | 4 | ▶ | use parent 'ColorThemeBase::Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 4 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||
| 9 | 4 | our $DATE = '2024-07-17'; # DATE | |||||||||
| 10 | 4 | our $DIST = 'ColorThemeBase-Static'; # DIST | |||||||||
| 11 | 4 | our $VERSION = '0.009'; # VERSION | |||||||||
| 12 | |||||||||||
| 13 | 2 | ▶ | sub list_items { | ||||||||
|
Subroutine
list_items: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 14 | 2 | my $self = shift; | |||||||||
| 15 | |||||||||||
| 16 | 2 | my $theme_hash = \%{"$self->{orig_class}::THEME"}; | |||||||||
| 17 | 2 | my @list = sort keys %{ $theme_hash->{items} }; | |||||||||
| 18 | 2 | ▶ | wantarray ? @list : \@list; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 6 | ▶ | sub get_item_color { | ||||||||
|
Subroutine
get_item_color: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 22 | 6 | my ($self, $name, $args) = @_; | |||||||||
| 23 | |||||||||||
| 24 | 6 | my $theme_hash = \%{"$self->{orig_class}::THEME"}; | |||||||||
| 25 | |||||||||||
| 26 | 6 | my $c = $theme_hash->{items}{$name}; | |||||||||
| 27 | 6 | ▶ | return unless defined $c; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | |||||||||||
| 29 | 5 | ▶ | if (ref $c eq 'CODE') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 1 | my $c2 = $c->($self, $name, $args); | |||||||||
| 31 | 1 | ▶ | if (ref $c2 eq 'CODE') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | die "Color '$name' of theme $self->{orig_class} returns coderef, ". | |||||||||
| 33 | "which after called still returns a coderef"; | ||||||||||
| 34 | } | ||||||||||
| 35 | 1 | return $c2; | |||||||||
| 36 | } | ||||||||||
| 37 | 4 | $c; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 4 | 1; | |||||||||
| 41 | # ABSTRACT: Base class for color theme modules with static list of items (from %THEME) | ||||||||||
| 42 | |||||||||||
| 43 | __END__ | ||||||||||