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-09'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'ColorThemeBase-Static'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.006'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
394
|
use strict 'subs', 'vars'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
9
|
|
|
|
|
|
|
#use warnings; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use parent 'ColorThemeBase::Base'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub list_items { |
14
|
2
|
|
|
2
|
0
|
10
|
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
|
|
|
|
14
|
wantarray ? @list : \@list; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get_item_color { |
22
|
6
|
|
|
6
|
0
|
20
|
my ($self, $name, $args) = @_; |
23
|
|
|
|
|
|
|
|
24
|
6
|
|
|
|
|
8
|
my $theme_hash = \%{"$self->{orig_class}::THEME"}; |
|
6
|
|
|
|
|
21
|
|
25
|
|
|
|
|
|
|
|
26
|
6
|
|
|
|
|
13
|
my $c = $theme_hash->{items}{$name}; |
27
|
6
|
100
|
|
|
|
16
|
return unless defined $c; |
28
|
|
|
|
|
|
|
|
29
|
5
|
100
|
|
|
|
12
|
if (ref $c eq 'CODE') { |
30
|
1
|
|
|
|
|
3
|
my $c2 = $c->($self, $name, $args); |
31
|
1
|
50
|
|
|
|
68
|
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
|
|
|
|
|
38
|
$c; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
# ABSTRACT: Base class for color theme modules with static list of items (from %THEME) |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |