File Coverage

blib/lib/Graphics/ColorNames/VACCC.pm
Criterion Covered Total %
statement 25 25 100.0
branch 4 4 100.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 33 34 97.0


line stmt bran cond sub pod time code
1             package Graphics::ColorNames::VACCC;
2              
3             =head1 NAME
4              
5             Graphics::ColorNames::VACCC - VisiBone Anglo-Centric Color Codes for Graphics::ColorNames
6              
7             =head1 SYNOPSIS
8              
9             require Graphics::ColorNames::VACCC;
10              
11             $NameTable = Graphics::ColorNames::VACCC->NamesRgbTable();
12             $RgbColor = $NameTable->{paledullred};
13              
14             =head1 DESCRIPTION
15              
16             This module defines color names and their associated RGB values for
17             the VisiBone Anglo-Centric Color Code. This is intended for use with
18             the L package.
19              
20             =head1 SEE ALSO
21              
22             A description of this color scheme can be found at
23             L.
24              
25             =head1 AUTHOR
26              
27             Robert Rothenberg
28              
29             =head2 Acknowledgements
30              
31             A while back I had received a request from somebody to implement this
32             as part of the L distribution. The request
33             included source code for the module. I had suggested to this person
34             that they upload a separate module to CPAN, but heard no reply.
35              
36             Afterwards I had lost the original E-mail.
37              
38             This version of the module was implemented separately.
39              
40             =head1 LICENSE
41              
42             Copyright (c) 2004 Robert Rothenberg. All rights reserved.
43             This program is free software; you can redistribute it and/or
44             modify it under the same terms as Perl itself.
45              
46             =cut
47              
48             require 5.006;
49              
50 1     1   7622 use strict;
  1         2  
  1         100  
51 1     1   7 use warnings;
  1         2  
  1         71  
52              
53             our $VERSION = '1.02';
54              
55             my %RgbColors = ( );
56              
57             sub NamesRgbTable() {
58 1     1   962 use integer;
  1         14  
  1         4  
59 2 100   2 0 38688 unless (keys %RgbColors) {
60 1         6 while (my $line = ) {
61 218         245 chomp($line);
62 218 100       396 if ($line) {
63 216         9654 my $rgb = eval "0x" . substr($line, 0, 6);
64             # die, unless ($rgb =~ /^\d+$/);
65 216         544 my $short = lc(substr($line, 8, 3)); $short =~ s/\s+$//;
  216         424  
66 216         338 my $long = lc(substr($line, 11)); $long =~ s/^\s+//;
  216         672  
67 216         511 $RgbColors{$short} = $rgb;
68 216         421 $RgbColors{$long} = $rgb;
69 216         1148 $long =~ s/\s+//g;
70 216         989 $RgbColors{$long} = $rgb;
71 216         366 $long =~ s/\-//g;
72 216         836 $RgbColors{$long} = $rgb;
73             }
74             }
75             }
76 2         319 return \%RgbColors;
77             }
78              
79             1;
80              
81             __DATA__