line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ColorTheme::Test::Dynamic; |
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
|
|
60349
|
use strict; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
26
|
|
9
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
10
|
1
|
|
|
1
|
|
374
|
use parent 'ColorThemeBase::Base'; |
|
1
|
|
|
|
|
272
|
|
|
1
|
|
|
|
|
5
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %THEME = ( |
13
|
|
|
|
|
|
|
v => 2, |
14
|
|
|
|
|
|
|
summary => 'A dynamic color theme', |
15
|
|
|
|
|
|
|
dynamic => 1, |
16
|
|
|
|
|
|
|
args => { |
17
|
|
|
|
|
|
|
tone => {schema=>['str*', in=>['red','green']], req=>1}, |
18
|
|
|
|
|
|
|
opt1 => {schema=>'str*', default=>'foo'}, |
19
|
|
|
|
|
|
|
opt2 => {schema=>'str*'}, |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub list_items { |
24
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my @list; |
27
|
0
|
0
|
|
|
|
|
if ($self->{tone} eq 'red') { |
28
|
0
|
|
|
|
|
|
@list = ('red1', 'red2', 'red3'); |
29
|
|
|
|
|
|
|
} else { |
30
|
0
|
|
|
|
|
|
@list = ('green1', 'green2', 'green3'); |
31
|
|
|
|
|
|
|
} |
32
|
0
|
0
|
|
|
|
|
wantarray ? @list : \@list; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub get_item_color { |
36
|
0
|
|
|
0
|
0
|
|
my ($self, $name, $args) = @_; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
+{ |
39
|
|
|
|
|
|
|
red1 => 'ff0000', |
40
|
|
|
|
|
|
|
red2 => 'cc0000', |
41
|
|
|
|
|
|
|
red3 => '992211', |
42
|
|
|
|
|
|
|
green1 => '00ff00', |
43
|
|
|
|
|
|
|
green2 => '00cc00', |
44
|
|
|
|
|
|
|
green3 => '15a008', |
45
|
0
|
|
|
|
|
|
}->{$name}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
# ABSTRACT: A dynamic color theme |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |