| 1 | 7 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 7 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Dist::Zilla::dumpphases::Role::Theme::SimpleColor; | ||||||||||
| 6 | |||||||||||
| 7 | 7 | our $VERSION = '1.000009'; | |||||||||
| 8 | |||||||||||
| 9 | # ABSTRACT: A role for themes that are simple single-color themes with variations of bold/uncolored. | ||||||||||
| 10 | |||||||||||
| 11 | 7 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||
| 12 | |||||||||||
| 13 | 7 | ▶ | use Role::Tiny qw( requires with ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | |||||||||||
| 16 | |||||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | |||||||||||
| 20 | |||||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | |||||||||||
| 27 | 7 | with 'Dist::Zilla::dumpphases::Role::Theme'; | |||||||||
| 28 | |||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | |||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | 7 | requires 'color'; | |||||||||
| 36 | |||||||||||
| 37 | ## no critic ( RequireArgUnpacking ) | ||||||||||
| 38 | 102 | ▶ | sub _colored { | ||||||||
|
Subroutine
_colored: called CC=2 SCAR=7.6
| |||||||||||
| 39 | 0 | ▶ | require Term::ANSIColor; () = eval { require Win32::Console::ANSI } if 'MSWin32' eq $^O; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 102 | goto \&Term::ANSIColor::colored; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 6 | ▶ | sub _color_label_label { | ||||||||
|
Subroutine
_color_label_label: called CC=1 SCAR=0.0
| |||||||||||
| 44 | 6 | my $self = shift; | |||||||||
| 45 | 6 | return _colored( [ $self->color ], @_ ); | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 6 | ▶ | sub _color_label_value { | ||||||||
|
Subroutine
_color_label_value: called CC=1 SCAR=0.0
| |||||||||||
| 49 | 6 | shift; | |||||||||
| 50 | 6 | return _colored( ['bold'], @_ ); | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 12 | ▶ | sub _color_attribute_label { | ||||||||
|
Subroutine
_color_attribute_label: called CC=1 SCAR=0.0
| |||||||||||
| 54 | 12 | my $self = shift; | |||||||||
| 55 | 12 | return _colored( [ $self->color, 'bold' ], @_ ); | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 12 | ▶ | sub _color_attribute_value { | ||||||||
|
Subroutine
_color_attribute_value: called CC=1 SCAR=0.0
| |||||||||||
| 59 | 12 | my $self = shift; | |||||||||
| 60 | 12 | return _colored( [ $self->color ], @_ ); | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | 33 | ▶ | sub _color_plugin_name { | ||||||||
|
Subroutine
_color_plugin_name: called CC=1 SCAR=0.0
| |||||||||||
| 64 | 33 | shift; | |||||||||
| 65 | 33 | return @_; | |||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 33 | ▶ | sub _color_plugin_package { | ||||||||
|
Subroutine
_color_plugin_package: called CC=1 SCAR=0.0
| |||||||||||
| 69 | 33 | my $self = shift; | |||||||||
| 70 | 33 | return _colored( [ $self->color ], @_ ); | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 33 | ▶ | sub _color_plugin_star { | ||||||||
|
Subroutine
_color_plugin_star: called CC=1 SCAR=0.0
| |||||||||||
| 74 | 33 | my $self = shift; | |||||||||
| 75 | 33 | return _colored( [ $self->color ], @_ ); | |||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | |||||||||||
| 79 | |||||||||||
| 80 | |||||||||||
| 81 | |||||||||||
| 82 | |||||||||||
| 83 | |||||||||||
| 84 | |||||||||||
| 85 | |||||||||||
| 86 | 6 | ▶ | sub print_section_header { | ||||||||
|
Subroutine
print_section_header: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 87 | 6 | my ( $self, $label, $comment ) = @_; | |||||||||
| 88 | 6 | return printf "\n%s%s\n", $self->_color_label_label($label), $self->_color_label_value($comment); | |||||||||
| 89 | } | ||||||||||
| 90 | |||||||||||
| 91 | |||||||||||
| 92 | |||||||||||
| 93 | |||||||||||
| 94 | |||||||||||
| 95 | |||||||||||
| 96 | |||||||||||
| 97 | |||||||||||
| 98 | |||||||||||
| 99 | 12 | ▶ | sub print_section_prelude { | ||||||||
|
Subroutine
print_section_prelude: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 100 | 12 | my ( $self, $label, $value ) = @_; | |||||||||
| 101 | 12 | return printf "%s%s\n", $self->_color_attribute_label( ' - ' . $label ), $self->_color_attribute_value($value); | |||||||||
| 102 | } | ||||||||||
| 103 | |||||||||||
| 104 | |||||||||||
| 105 | |||||||||||
| 106 | |||||||||||
| 107 | |||||||||||
| 108 | |||||||||||
| 109 | |||||||||||
| 110 | |||||||||||
| 111 | |||||||||||
| 112 | 33 | ▶ | sub print_star_assoc { | ||||||||
|
Subroutine
print_star_assoc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 113 | 33 | my ( $self, $name, $value ) = @_; | |||||||||
| 114 | 33 | return printf "%s%s%s\n", | |||||||||
| 115 | $self->_color_plugin_star(' * '), | ||||||||||
| 116 | $self->_color_plugin_name($name), | ||||||||||
| 117 | $self->_color_plugin_package( ' => ' . $value ); | ||||||||||
| 118 | } | ||||||||||
| 119 | |||||||||||
| 120 | |||||||||||
| 121 | |||||||||||
| 122 | |||||||||||
| 123 | |||||||||||
| 124 | |||||||||||
| 125 | |||||||||||
| 126 | |||||||||||
| 127 | |||||||||||
| 128 | |||||||||||
| 129 | |||||||||||
| 130 | |||||||||||
| 131 | |||||||||||
| 132 | |||||||||||
| 133 | |||||||||||
| 134 | 7 | 1; | |||||||||
| 135 | |||||||||||
| 136 | __END__ | ||||||||||