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.007'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
416
|
use strict 'subs', 'vars'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
9
|
|
|
|
|
|
|
#use warnings; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use parent 'ColorThemeBase::Base'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub list_items { |
14
|
2
|
|
|
2
|
0
|
12
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
2
|
my $theme_hash = \%{"$self->{orig_class}::THEME"}; |
|
2
|
|
|
|
|
10
|
|
17
|
2
|
|
|
|
|
4
|
my @list = sort keys %{ $theme_hash->{items} }; |
|
2
|
|
|
|
|
12
|
|
18
|
2
|
100
|
|
|
|
16
|
wantarray ? @list : \@list; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get_item_color { |
22
|
6
|
|
|
6
|
0
|
18
|
my ($self, $name, $args) = @_; |
23
|
|
|
|
|
|
|
|
24
|
6
|
|
|
|
|
7
|
my $theme_hash = \%{"$self->{orig_class}::THEME"}; |
|
6
|
|
|
|
|
23
|
|
25
|
|
|
|
|
|
|
|
26
|
6
|
|
|
|
|
14
|
my $c = $theme_hash->{items}{$name}; |
27
|
6
|
100
|
|
|
|
17
|
return unless defined $c; |
28
|
|
|
|
|
|
|
|
29
|
5
|
100
|
|
|
|
11
|
if (ref $c eq 'CODE') { |
30
|
1
|
|
|
|
|
5
|
my $c2 = $c->($self, $name, $args); |
31
|
1
|
50
|
|
|
|
79
|
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__ |