| 1 | package Graphics::ColorNames::WWW; | ||
| 2 | |||
| 3 | 7 | require 5.006; | |
| 4 | |||
| 5 | 7 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 7 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 7 | our $VERSION = '1.14'; | |
| 9 | |||
| 10 | 8 | ▶ | sub NamesRgbTable() { |
|
Subroutine
NamesRgbTable: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 11 | 1168 | ▶ | sub _mk_rgb { ($_[0] << 16) + ($_[1] << 8) + ($_[2]) } |
|
Subroutine
_mk_rgb: called CC=1 SCAR=0.0
| |||
| 12 | 7 | ▶ | use integer; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | return { | ||
| 14 | 8 | 'aliceblue' => _mk_rgb(240, 248, 255), | |
| 15 | 'antiquewhite' => _mk_rgb(250, 235, 215), | ||
| 16 | 'aqua' => _mk_rgb( 0, 255, 255), | ||
| 17 | 'aquamarine' => _mk_rgb(127, 255, 212), | ||
| 18 | 'azure' => _mk_rgb(240, 255, 255), | ||
| 19 | 'beige' => _mk_rgb(245, 245, 220), | ||
| 20 | 'bisque' => _mk_rgb(255, 228, 196), | ||
| 21 | 'black' => _mk_rgb( 0, 0, 0), | ||
| 22 | 'blanchedalmond' => _mk_rgb(255, 235, 205), | ||
| 23 | 'blue' => _mk_rgb( 0, 0, 255), | ||
| 24 | 'blueviolet' => _mk_rgb(138, 43, 226), | ||
| 25 | 'brown' => _mk_rgb(165, 42, 42), | ||
| 26 | 'burlywood' => _mk_rgb(222, 184, 135), | ||
| 27 | 'cadetblue' => _mk_rgb( 95, 158, 160), | ||
| 28 | 'chartreuse' => _mk_rgb(127, 255, 0), | ||
| 29 | 'chocolate' => _mk_rgb(210, 105, 30), | ||
| 30 | 'coral' => _mk_rgb(255, 127, 80), | ||
| 31 | 'cornflowerblue' => _mk_rgb(100, 149, 237), | ||
| 32 | 'cornsilk' => _mk_rgb(255, 248, 220), | ||
| 33 | 'crimson' => _mk_rgb(220, 20, 60), | ||
| 34 | 'cyan' => _mk_rgb( 0, 255, 255), | ||
| 35 | 'darkblue' => _mk_rgb( 0, 0, 139), | ||
| 36 | 'darkcyan' => _mk_rgb( 0, 139, 139), | ||
| 37 | 'darkgoldenrod' => _mk_rgb(184, 134, 11), | ||
| 38 | 'darkgray' => _mk_rgb(169, 169, 169), | ||
| 39 | 'darkgreen' => _mk_rgb( 0, 100, 0), | ||
| 40 | 'darkgrey' => _mk_rgb(169, 169, 169), | ||
| 41 | 'darkkhaki' => _mk_rgb(189, 183, 107), | ||
| 42 | 'darkmagenta' => _mk_rgb(139, 0, 139), | ||
| 43 | 'darkolivegreen' => _mk_rgb( 85, 107, 47), | ||
| 44 | 'darkorange' => _mk_rgb(255, 140, 0), | ||
| 45 | 'darkorchid' => _mk_rgb(153, 50, 204), | ||
| 46 | 'darkred' => _mk_rgb(139, 0, 0), | ||
| 47 | 'darksalmon' => _mk_rgb(233, 150, 122), | ||
| 48 | 'darkseagreen' => _mk_rgb(143, 188, 143), | ||
| 49 | 'darkslateblue' => _mk_rgb( 72, 61, 139), | ||
| 50 | 'darkslategray' => _mk_rgb( 47, 79, 79), | ||
| 51 | 'darkslategrey' => _mk_rgb( 47, 79, 79), | ||
| 52 | 'darkturquoise' => _mk_rgb( 0, 206, 209), | ||
| 53 | 'darkviolet' => _mk_rgb(148, 0, 211), | ||
| 54 | 'deeppink' => _mk_rgb(255, 20, 147), | ||
| 55 | 'deepskyblue' => _mk_rgb( 0, 191, 255), | ||
| 56 | 'dimgray' => _mk_rgb(105, 105, 105), | ||
| 57 | 'dimgrey' => _mk_rgb(105, 105, 105), | ||
| 58 | 'dodgerblue' => _mk_rgb( 30, 144, 255), | ||
| 59 | 'firebrick' => _mk_rgb(178, 34, 34), | ||
| 60 | 'floralwhite' => _mk_rgb(255, 250, 240), | ||
| 61 | 'forestgreen' => _mk_rgb( 34, 139, 34), | ||
| 62 | 'fuchsia' => 0xff00ff, # "fuscia" is incorrect but common | ||
| 63 | 'fuscia' => 0xff00ff, # mis-spelling... | ||
| 64 | 'gainsboro' => _mk_rgb(220, 220, 220), | ||
| 65 | 'ghostwhite' => _mk_rgb(248, 248, 255), | ||
| 66 | 'gold' => _mk_rgb(255, 215, 0), | ||
| 67 | 'goldenrod' => _mk_rgb(218, 165, 32), | ||
| 68 | 'gray' => _mk_rgb(128, 128, 128), | ||
| 69 | 'grey' => _mk_rgb(128, 128, 128), | ||
| 70 | 'green' => _mk_rgb( 0, 128, 0), | ||
| 71 | 'greenyellow' => _mk_rgb(173, 255, 47), | ||
| 72 | 'honeydew' => _mk_rgb(240, 255, 240), | ||
| 73 | 'hotpink' => _mk_rgb(255, 105, 180), | ||
| 74 | 'indianred' => _mk_rgb(205, 92, 92), | ||
| 75 | 'indigo' => _mk_rgb( 75, 0, 130), | ||
| 76 | 'ivory' => _mk_rgb(255, 255, 240), | ||
| 77 | 'khaki' => _mk_rgb(240, 230, 140), | ||
| 78 | 'lavender' => _mk_rgb(230, 230, 250), | ||
| 79 | 'lavenderblush' => _mk_rgb(255, 240, 245), | ||
| 80 | 'lawngreen' => _mk_rgb(124, 252, 0), | ||
| 81 | 'lemonchiffon' => _mk_rgb(255, 250, 205), | ||
| 82 | 'lightblue' => _mk_rgb(173, 216, 230), | ||
| 83 | 'lightcoral' => _mk_rgb(240, 128, 128), | ||
| 84 | 'lightcyan' => _mk_rgb(224, 255, 255), | ||
| 85 | 'lightgoldenrodyellow' => _mk_rgb(250, 250, 210), | ||
| 86 | 'lightgray' => _mk_rgb(211, 211, 211), | ||
| 87 | 'lightgreen' => _mk_rgb(144, 238, 144), | ||
| 88 | 'lightgrey' => _mk_rgb(211, 211, 211), | ||
| 89 | 'lightpink' => _mk_rgb(255, 182, 193), | ||
| 90 | 'lightsalmon' => _mk_rgb(255, 160, 122), | ||
| 91 | 'lightseagreen' => _mk_rgb( 32, 178, 170), | ||
| 92 | 'lightskyblue' => _mk_rgb(135, 206, 250), | ||
| 93 | 'lightslategray' => _mk_rgb(119, 136, 153), | ||
| 94 | 'lightslategrey' => _mk_rgb(119, 136, 153), | ||
| 95 | 'lightsteelblue' => _mk_rgb(176, 196, 222), | ||
| 96 | 'lightyellow' => _mk_rgb(255, 255, 224), | ||
| 97 | 'lime' => _mk_rgb( 0, 255, 0), | ||
| 98 | 'limegreen' => _mk_rgb( 50, 205, 50), | ||
| 99 | 'linen' => _mk_rgb(250, 240, 230), | ||
| 100 | 'magenta' => _mk_rgb(255, 0, 255), | ||
| 101 | 'maroon' => _mk_rgb(128, 0, 0), | ||
| 102 | 'mediumaquamarine' => _mk_rgb(102, 205, 170), | ||
| 103 | 'mediumblue' => _mk_rgb( 0, 0, 205), | ||
| 104 | 'mediumorchid' => _mk_rgb(186, 85, 211), | ||
| 105 | 'mediumpurple' => _mk_rgb(147, 112, 219), | ||
| 106 | 'mediumseagreen' => _mk_rgb( 60, 179, 113), | ||
| 107 | 'mediumslateblue' => _mk_rgb(123, 104, 238), | ||
| 108 | 'mediumspringgreen' => _mk_rgb( 0, 250, 154), | ||
| 109 | 'mediumturquoise' => _mk_rgb( 72, 209, 204), | ||
| 110 | 'mediumvioletred' => _mk_rgb(199, 21, 133), | ||
| 111 | 'midnightblue' => _mk_rgb( 25, 25, 112), | ||
| 112 | 'mintcream' => _mk_rgb(245, 255, 250), | ||
| 113 | 'mistyrose' => _mk_rgb(255, 228, 225), | ||
| 114 | 'moccasin' => _mk_rgb(255, 228, 181), | ||
| 115 | 'navajowhite' => _mk_rgb(255, 222, 173), | ||
| 116 | 'navy' => _mk_rgb( 0, 0, 128), | ||
| 117 | 'oldlace' => _mk_rgb(253, 245, 230), | ||
| 118 | 'olive' => _mk_rgb(128, 128, 0), | ||
| 119 | 'olivedrab' => _mk_rgb(107, 142, 35), | ||
| 120 | 'orange' => _mk_rgb(255, 165, 0), | ||
| 121 | 'orangered' => _mk_rgb(255, 69, 0), | ||
| 122 | 'orchid' => _mk_rgb(218, 112, 214), | ||
| 123 | 'palegoldenrod' => _mk_rgb(238, 232, 170), | ||
| 124 | 'palegreen' => _mk_rgb(152, 251, 152), | ||
| 125 | 'paleturquoise' => _mk_rgb(175, 238, 238), | ||
| 126 | 'palevioletred' => _mk_rgb(219, 112, 147), | ||
| 127 | 'papayawhip' => _mk_rgb(255, 239, 213), | ||
| 128 | 'peachpuff' => _mk_rgb(255, 218, 185), | ||
| 129 | 'peru' => _mk_rgb(205, 133, 63), | ||
| 130 | 'pink' => _mk_rgb(255, 192, 203), | ||
| 131 | 'plum' => _mk_rgb(221, 160, 221), | ||
| 132 | 'powderblue' => _mk_rgb(176, 224, 230), | ||
| 133 | 'purple' => _mk_rgb(128, 0, 128), | ||
| 134 | 'red' => _mk_rgb(255, 0, 0), | ||
| 135 | 'rosybrown' => _mk_rgb(188, 143, 143), | ||
| 136 | 'royalblue' => _mk_rgb( 65, 105, 225), | ||
| 137 | 'saddlebrown' => _mk_rgb(139, 69, 19), | ||
| 138 | 'salmon' => _mk_rgb(250, 128, 114), | ||
| 139 | 'sandybrown' => _mk_rgb(244, 164, 96), | ||
| 140 | 'seagreen' => _mk_rgb( 46, 139, 87), | ||
| 141 | 'seashell' => _mk_rgb(255, 245, 238), | ||
| 142 | 'sienna' => _mk_rgb(160, 82, 45), | ||
| 143 | 'silver' => _mk_rgb(192, 192, 192), | ||
| 144 | 'skyblue' => _mk_rgb(135, 206, 235), | ||
| 145 | 'slateblue' => _mk_rgb(106, 90, 205), | ||
| 146 | 'slategray' => _mk_rgb(112, 128, 144), | ||
| 147 | 'slategrey' => _mk_rgb(112, 128, 144), | ||
| 148 | 'snow' => _mk_rgb(255, 250, 250), | ||
| 149 | 'springgreen' => _mk_rgb( 0, 255, 127), | ||
| 150 | 'steelblue' => _mk_rgb( 70, 130, 180), | ||
| 151 | 'tan' => _mk_rgb(210, 180, 140), | ||
| 152 | 'teal' => _mk_rgb( 0, 128, 128), | ||
| 153 | 'thistle' => _mk_rgb(216, 191, 216), | ||
| 154 | 'tomato' => _mk_rgb(255, 99, 71), | ||
| 155 | 'turquoise' => _mk_rgb( 64, 224, 208), | ||
| 156 | 'violet' => _mk_rgb(238, 130, 238), | ||
| 157 | 'wheat' => _mk_rgb(245, 222, 179), | ||
| 158 | 'white' => _mk_rgb(255, 255, 255), | ||
| 159 | 'whitesmoke' => _mk_rgb(245, 245, 245), | ||
| 160 | 'yellow' => _mk_rgb(255, 255, 0), | ||
| 161 | 'yellowgreen' => _mk_rgb(154, 205, 50), | ||
| 162 | }; | ||
| 163 | } | ||
| 164 | |||
| 165 | 7 | 1; | |
| 166 | |||
| 167 | =head1 NAME | ||
| 168 | |||
| 169 | Graphics::ColorNames::WWW - WWW color names and equivalent RGB values | ||
| 170 | |||
| 171 | =head1 SYNOPSIS | ||
| 172 | |||
| 173 | require Graphics::ColorNames::WWW; | ||
| 174 | |||
| 175 | $NameTable = Graphics::ColorNames::WWW->NamesRgbTable(); | ||
| 176 | $RgbBlack = $NameTable->{black}; | ||
| 177 | |||
| 178 | =head1 DESCRIPTION | ||
| 179 | |||
| 180 | This module defines color names and their associated RGB values from various | ||
| 181 | WWW specifications, such as SVG or CSS as well as common browser | ||
| 182 | implementations. | ||
| 183 | |||
| 184 | See the documentation of L<Graphics::ColorNames> for information how to use | ||
| 185 | this module. | ||
| 186 | |||
| 187 | Currently, SVG and CSS define the same color keywords and include all color | ||
| 188 | keywords supported by common web browsers. Therefore, the modules | ||
| 189 | Graphics::ColorNames::WWW, L<Graphics::ColorNames::SVG> and | ||
| 190 | L<Graphics::ColorNames::CSS> behave in identical ways. | ||
| 191 | |||
| 192 | This may change if the specs should happen to diverge; then this module will | ||
| 193 | become a superset of all color keywords defined by W3C's specs. | ||
| 194 | |||
| 195 | It is recommended to use this module unless you require exact compatibility | ||
| 196 | with the CSS and SVG specifications or specific browsers. | ||
| 197 | |||
| 198 | =head2 NOTE | ||
| 199 | |||
| 200 | Reportedly "fuchsia" was misspelled "fuscia" in an unidentified HTML | ||
| 201 | specification. It also appears to be a common misspelling, so both names are | ||
| 202 | recognized. | ||
| 203 | |||
| 204 | =head1 LIMITATIONS | ||
| 205 | |||
| 206 | The C<transparent> keyword is unsupported. Currently, Graphics::ColorNames does | ||
| 207 | not allow RGBA values. | ||
| 208 | |||
| 209 | Further, the system color keywords are not assigned to a fixed RGB value and | ||
| 210 | thus unsupported: C<ActiveBorder>, C<ActiveCaption>, C<AppWorkspace>, | ||
| 211 | C<Background>, C<ButtonFace>, C<ButtonHighlight>, C<ButtonShadow>, | ||
| 212 | C<ButtonText>, C<CaptionText>, C<GrayText>, C<Highlight>, C<HighlightText>, | ||
| 213 | C<InactiveBorder>, C<InactiveCaption>, C<InactiveCaptionText>, | ||
| 214 | C<InfoBackground>, C<InfoText>, C<Menu>, C<MenuText>, C<Scrollbar>, | ||
| 215 | C<ThreeDDarkShadow>, C<ThreeDFace>, C<ThreeDHighlight>, C<ThreeDLightShadow>, | ||
| 216 | C<ThreeDShadow>, C<Window>, C<WindowFrame>, C<WindowText> (these are deprecated | ||
| 217 | in CSS3) | ||
| 218 | |||
| 219 | =head1 SEE ALSO | ||
| 220 | |||
| 221 | L<Graphics::ColorNames::HTML>, L<Graphics::ColorNames::CSS>, | ||
| 222 | L<Graphics::ColorNames::SVG> | ||
| 223 | |||
| 224 | =head1 AUTHOR | ||
| 225 | |||
| 226 | Claus FE<auml>rber <CFAERBER@cpan.org> | ||
| 227 | |||
| 228 | Based on C<Graphics::ColorNames::HTML> by Robert Rothenberg. | ||
| 229 | |||
| 230 | =head1 LICENSE | ||
| 231 | |||
| 232 | Copyright 2005-2009 Claus FE<auml>rber. | ||
| 233 | |||
| 234 | Copyright 2001-2004 Robert Rothenberg. | ||
| 235 | |||
| 236 | All rights reserved. This program is free software; you can | ||
| 237 | redistribute it and/or modify it under the same terms as Perl | ||
| 238 | itself. | ||
| 239 | |||
| 240 | =cut | ||