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