Treex/Core/TredView/Colors.pm

filter: Statementstmt 45.4% 10 / 22 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 2 / 6 Podpod 0.0% 0 / 2 totaltotal 31.5% 12 / 38 CC 5 SCAR 27.6
CC
5
Cov
33%
get
30.0
_build_colors
2.0
__ANON__
2.0
CRAP 15.8
« Treex/Core/Phrase/BaseNTerm.pm ↑ Summary Treex/Block/Write/Sentences.pm »
1 package Treex::Core::TredView::Colors;
2 3 $Treex::Core::TredView::Colors::VERSION = '2.20151210';
3 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Treex::Core::Log;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 has '_colors' => (
7 is => 'ro',
8 isa => 'HashRef[Str]',
9 builder => '_build_colors'
10 );
11  
12 sub _build_colors {
13 return {
14 0 ▶ 'edge' => '#555555',
Subroutine _build_colors: not called CC=1 SCAR=6.9
15 'coord' => '#bbbbbb',
16 'error' => '#ff0000',
17 'coord_mod' => 'aquamarine4',
18  
19 'anode' => '#ff6666',
20 'anode_coord' => '#ff6666',
21 'nnode' => '#ffff00',
22 'tnode' => '#4488ff',
23 'tnode_coord' => '#ccddff',
24 'terminal' => '#ffff66',
25 'terminal_head' => '#90ee90',
26 'nonterminal_head' => '#90ee90',
27 'nonterminal' => '#ffffe0',
28 'trace' => '#aaaaaa',
29 'current' => '#ff0000',
30  
31 'coref_gram' => '#c05633',
32 'coref_text' => '#4c509f',
33 'compl' => '#629f52',
34 'coindex' => '#ffa500', #orange
35  
36 # various alignment link types
37 'alignment' => '#bebebe',
38 'left' => '#bebebe',
39 'right' => '#bebebe',
40 'int' => '#bebebe',
41 'gdfa' => '#bebebe',
42 'revgdfa' => '#bebebe',
43 'rule-based' => '#bebebe',
44 'monolingual' => '#bebebe',
45 'copy' => '#bebebe',
46  
47 'lex' => '#006400',
48 'aux' => '#ff8c00',
49 'parenthesis' => '#809080',
50 'afun' => '#00008b',
51 'member' => '#0000ff',
52 'sentmod' => '#006400',
53 'subfunctor' => '#a02818',
54 'nodetype' => '#00008b',
55 'sempos' => '#8b008b',
56 'phrase' => '#00008b',
57 'formeme' => '#b000b0',
58 'tag' => '#004048',
59 'tag_feat' => '#7098A0',
60 'translit' => '#444400',
61 'gloss' => '#888800',
62  
63 'clause0' => '#ff00ff', #magenta
64 'clause1' => '#ffa500', #orange
65 'clause2' => '#0000ff', #blue
66 'clause3' => '#3cb371', #MediumSeaGreen
67 'clause4' => '#ff0000', #red
68 'clause5' => '#9932cc', #DarkOrchid
69 'clause6' => '#00008b', #DarkBlue
70 'clause7' => '#006400', #DarkGreen
71 'clause8' => '#8b0000', #DarkRed
72 'clause9' => '#008b8b', #DarkCyan
73  
74 '_default' => 'cyan',
75 };
76 }
77  
78 # This is just to prevent repeating warning for the same unknown color code
79 has '_unknown_codes' => (
80 is => 'ro',
81 isa => 'HashRef[Bool]',
82 0 ▶ default => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
83 3 );
84  
85 sub get {
86 0 ▶ my ( $self, $code, $markup ) = @_;
Subroutine get: not called CC=5 SCAR=34.0
Pod undocumented
87  
88 # try to truncate complex alignment types to first one (e.g. "gdfa.int.left.right.revgdfa" -> "gdfa")
89 0 ▶ $code =~ s/\..*// if ( not exists $self->_colors->{$code} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->_colors->{$code} 0 0 0
90  
91 # warn if the appropriate color still does not exist
92 0 ▶ if ( !defined( $self->_colors->{$code} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->_colors->{$code}) 0 0 0
93 0 ▶ log_warn "Unknown color code '$code'\n" if ( !$self->_unknown_codes->{$code} );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_unknown_codes->{$code} 0 0 0
94 0 $self->_unknown_codes->{$code} = 1;
95 0 $code = '_default';
96 }
97 0 $code = $self->_colors->{$code};
98 0 ▶ return $markup ? '#{' . $code . '}' : $code;
Branch: 1 branch
BranchTrueFalseTotal
$markup ? : 0 0 0
99 }
100  
101 sub get_clause_color {
102 0 ▶ my ( $self, $clause_number, $code, $markup ) = @_;
Subroutine get_clause_color: not called CC=1 SCAR=6.9
Pod undocumented
103 0 return $self->get( 'clause' . ( $clause_number % 10 ), $markup );
104 }
105  
106 3 1;
107  
108 __END__
109  
110 =pod
111  
112 =encoding utf-8
113  
114 =head1 NAME
115  
116 Treex::Core::TredView::Colors - List of colors used in TrEd
117  
118 =head1 VERSION
119  
120 version 2.20151210
121  
122 =head1 DESCRIPTION
123  
124 This package provides names for common colors used in TrEd.
125  
126 =head1 AUTHOR
127  
128 =head1 COPYRIGHT AND LICENSE
129  
130 Copyright © 2011-2012 by Institute of Formal and Applied Linguistics, Charles University in Prague
131  
132 This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
« Treex/Core/Phrase/BaseNTerm.pm ↑ Summary Treex/Block/Write/Sentences.pm »