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.008'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
59606
|
use strict; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
25
|
|
9
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
10
|
1
|
|
|
1
|
|
366
|
use parent 'ColorThemeBase::Base'; |
|
1
|
|
|
|
|
257
|
|
|
1
|
|
|
|
|
4
|
|
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
|
|
|
|
|
|
|
examples => [ |
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
summary => 'An red tone', |
24
|
|
|
|
|
|
|
args => { tone => 'red' }, |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
], |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub list_items { |
30
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my @list; |
33
|
0
|
0
|
|
|
|
|
if ($self->{tone} eq 'red') { |
34
|
0
|
|
|
|
|
|
@list = ('red1', 'red2', 'red3'); |
35
|
|
|
|
|
|
|
} else { |
36
|
0
|
|
|
|
|
|
@list = ('green1', 'green2', 'green3'); |
37
|
|
|
|
|
|
|
} |
38
|
0
|
0
|
|
|
|
|
wantarray ? @list : \@list; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub get_item_color { |
42
|
0
|
|
|
0
|
0
|
|
my ($self, $name, $args) = @_; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
+{ |
45
|
|
|
|
|
|
|
red1 => 'ff0000', |
46
|
|
|
|
|
|
|
red2 => 'cc0000', |
47
|
|
|
|
|
|
|
red3 => '992211', |
48
|
|
|
|
|
|
|
green1 => '00ff00', |
49
|
|
|
|
|
|
|
green2 => '00cc00', |
50
|
|
|
|
|
|
|
green3 => '15a008', |
51
|
0
|
|
|
|
|
|
}->{$name}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
# ABSTRACT: A dynamic color theme |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |