1<?php
2/**
3 *
4 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
5 * @author     Andreas Gohr <andi@splitbrain.org>
6 */
7
8if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
9if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
10require_once(DOKU_PLUGIN.'syntax.php');
11
12class syntax_plugin_graphgear extends DokuWiki_Syntax_Plugin {
13    var $nodes;
14    var $edges;
15    var $colors;
16
17    /**
18     * What kind of syntax are we?
19     */
20    function getType(){
21        return 'substition';
22    }
23
24    function getPType(){
25        return 'block';
26    }
27
28    /**
29     * Where to sort in?
30     */
31    function getSort(){
32        return 160;
33    }
34
35    /**
36     * Connect pattern to lexer
37     */
38    function connectTo($mode) {
39      $this->Lexer->addSpecialPattern('<graphgear.*?>\n.*?\n</graphgear>',$mode,'plugin_graphgear');
40    }
41
42    /**
43     * Handle the match
44     */
45    function handle($data, $state, $pos, Doku_Handler $handler){
46        $data = explode("\n",$data);
47        $conf  = array_shift($data);
48        array_pop($data);
49        $conf  = trim(substr($conf,10,-1));
50        $conf  = $this->parseOpts($conf);
51
52        // parse
53        $count = count($data);
54        for($i=0; $i<$count; $i++){
55            // copy line, free memory
56            $line = $data[$i];
57            unset($data[$i]);
58
59            $line = trim($line);
60            $line = rtrim($line," ;");
61
62            if(strpos($line,'->') === false){
63                $opt = $this->parseNode($line);
64            }else{
65                $opt = $this->parseEdge($line);
66            }
67        }
68
69        $xml   = $this->getXML($conf,$w,$h);
70        $xmlid = md5($xml);
71        $cache = getcachename($xmlid,'graphgear');
72        io_saveFile($cache,$xml);
73
74        return array(
75            'xmlid'  => $xmlid,
76            'width'  => $w,
77            'height' => $h,
78        );
79    }
80
81    function render($mode, Doku_Renderer $R, $data) {
82        if($mode != 'xhtml') return false;
83
84        $R->doc .= sprintf('<object width="%d" height="%d">
85                                <param name="movie" value="%s"></param>
86                                <param name="wmode" value="transparent"></param>
87                                <param name="FlashVars" value="graphXMLFile=%s"></param>
88                                <param name="allowFullScreen" value="true"/></param>
89                                <param name="allowScriptAccess" value="always"></param>
90                                <param name="salign" value="tl"></param>
91                                <param name="scale" value="noborder"></param>
92                                <embed src="%s"
93                                       type="application/x-shockwave-flash"
94                                       wmode="transparent"
95                                       allowfullscreen="true"
96                                       allowscriptaccess="always"
97                                       salign="tl"
98                                       scale="noborder"
99                                       width="%d"
100                                       height="%d"
101                                       FlashVars="graphXMLFile=%s"></embed>
102                            </object>',
103                            $data['width'],
104                            $data['height'],
105                            DOKU_BASE.'lib/plugins/graphgear/GraphGear.swf',
106                            DOKU_BASE.'lib/plugins/graphgear/load.php?xmlid='.$data['xmlid'],
107                            DOKU_BASE.'lib/plugins/graphgear/GraphGear.swf',
108                            $data['width'],
109                            $data['height'],
110                            DOKU_BASE.'lib/plugins/graphgear/load.php?xmlid='.$data['xmlid']
111                    );
112        //$R->doc .= $data['xmlid'];
113        return true;
114    }
115
116
117    function color($in,$default){
118        if($in){
119            if($this->colors[$in]){
120                return $this->colors[$in];
121            }elseif($opts['fillcolor'][0] == '#'){
122                return substr($in,1);
123            }else{
124                return $in;
125            }
126        }
127        return $default;
128    }
129
130    function getXML($conf,&$w,&$h){
131        $this->initColors();
132
133        $xml = '<?xml version="1.0"?>'."\n";
134
135        // graph node
136        $graph = array(
137                    'type'      => 'undirected',
138                    'width'     => 725,
139                    'height'    => 400,
140                    'title'     => $conf['title'],
141                    'bgcolor'   => $this->color($conf['bgcolor'],'ffffff'),
142                    'linecolor' => $this->color($conf['linecolor'],'cccccc'),
143                    'viewmode'  => 'explore',
144                    'hidelabel' => 'false',
145                 );
146        if((int) $conf['width']) $graph['width']   = (int) $conf['width'];
147        if((int) $conf['height']) $graph['height'] = (int) $conf['height'];
148        if($conf['label']) $graph['title'] = $conf['label'];
149        if($conf['viewmode'] == 'display') $graph['viewmode'] = 'display';
150        if($conf['mode'] == 'directed') $graph['mode'] = 'directed';
151        $xml .= '<graph '.html_attbuild($graph).">\n";
152
153        $w = $graph['width'];
154        $h = $graph['height'];
155
156        // nodes
157        foreach($this->nodes as $name => $opts){
158            $node = array(
159                'id'        => $name,
160                'text'      => (($opts['label']) ? $opts['label'] : $name),
161                'color'     => $this->color($opts['fillcolor'],'cccccc'),
162                'textcolor' => $this->color($opts['fontcolor'],'000000'),
163            );
164            if($opts['url']){
165                if(preg_match('/^\w+:\/\//',$opts['url'])){
166                    $node['link'] = $opts['url'];
167                }else{
168                    $node['link'] = wl($opts['url']);
169                }
170            }
171            if($opts['image']){
172                $node['image'] = ml($opts['image'],array('w'=>40,'h'=>40),true,'&');
173            }
174            if(preg_match('/^(box|rect|rectangle|polygon|diamond|trapezium|parallelogram|Msquare|box3d|component)$/',$opts['shape'])) $node['type'] = 'SquareNode';
175
176            $xml .= '    <node '.html_attbuild($node)." />\n";
177        }
178        $xml .= "\n";
179
180        // edges
181        foreach($this->edges as $edge){
182            $opts = (array) $edge[2];
183            $edge = array(
184                'sourceNode' => $edge[0],
185                'targetNode' => $edge[1],
186                'label'      => $opts['label'],
187                'textcolor'  => $this->color($opts['fontcolor'],'000000'),
188            );
189            $xml .= '    <edge '.html_attbuild($edge)." />\n";
190        }
191
192        $xml .= '</graph>';
193        return $xml;
194    }
195
196
197    function parseNode($line){
198        list($node,$opts) = explode('[',$line,2);
199        if($opts){
200            $opts = rtrim($opts,']');
201            $opts = $this->parseOpts($opts);
202        }
203        $node = trim($node);
204
205        if($node) $this->nodes[$node] = $opts;
206    }
207
208    function parseEdge($line){
209        list($edge,$opts) = explode('[',$line,2);
210        if($opts){
211            $opts = rtrim($opts,']');
212            $opts = $this->parseOpts($opts);
213        }
214        list($from,$to) = explode('->',$edge,2);
215        $from = trim($from);
216        $to   = trim($to);
217        if(!isset($this->nodes[$from])) $this->nodes[$from] = array();
218        if(!isset($this->nodes[$to])) $this->nodes[$to] = array();
219
220        if($from && $to) $this->edges[] = array($from,$to,(array)$opts);
221    }
222
223    function parseOpts($string){
224        $data = array();
225
226        $dq    = false;
227        $iskey = true;
228        $key   = '';
229        $val   = '';
230
231        $len = strlen($string);
232        for($i=0; $i<=$len; $i++){
233            // done for this one?
234            if($string[$i] == ',' || $i == $len){
235                $key = trim($key);
236                $val = trim($val);
237                if($key && $val) $data[strtolower($key)] = $val;
238                $iskey = true;
239                $key = '';
240                $val = '';
241                continue;
242            }
243
244            // double quotes
245            if($string[$i] == '"'){
246                if($dq){
247                    $dq == false;
248                }else{
249                    $dq == true;
250                }
251                continue;
252            }
253
254            // key value separator
255            if($string[$i] == '=' && !$dq && $iskey){
256                $iskey = false;
257                continue;
258            }
259
260            //default
261            if($iskey){
262                $key .= $string[$i];
263            }else{
264                $val .= $string[$i];
265            }
266        }
267        return $data;
268    }
269
270    function initColors(){
271        $this->colors = array(
272            'antiquewhite4' => '8b8378',
273            'aquamarine' => '7fffd4',
274            'aquamarine1' => '7fffd4',
275            'aquamarine2' => '76eec6',
276            'aquamarine3' => '66cdaa',
277            'aquamarine4' => '458b74',
278            'azure' => 'f0ffff',
279            'azure1' => 'f0ffff',
280            'azure2' => 'e0eeee',
281            'azure3' => 'c1cdcd',
282            'azure4' => '838b8b',
283            'beige' => 'f5f5dc',
284            'bisque' => 'ffe4c4',
285            'bisque1' => 'ffe4c4',
286            'bisque2' => 'eed5b7',
287            'bisque3' => 'cdb79e',
288            'bisque4' => '8b7d6b',
289            'black' => '000000',
290            'blanchedalmond' => 'ffebcd',
291            'blue' => '0000ff',
292            'blue1' => '0000ff',
293            'blue2' => '0000ee',
294            'blue3' => '0000cd',
295            'blue4' => '00008b',
296            'blueviolet' => '8a2be2',
297            'brown' => 'a52a2a',
298            'brown1' => 'ff4040',
299            'brown2' => 'ee3b3b',
300            'brown3' => 'cd3333',
301            'brown4' => '8b2323',
302            'burlywood' => 'deb887',
303            'burlywood1' => 'ffd39b',
304            'burlywood2' => 'eec591',
305            'burlywood3' => 'cdaa7d',
306            'burlywood4' => '8b7355',
307            'cadetblue' => '5f9ea0',
308            'cadetblue1' => '98f5ff',
309            'cadetblue2' => '8ee5ee',
310            'cadetblue3' => '7ac5cd',
311            'cadetblue4' => '53868b',
312            'chartreuse' => '7fff00',
313            'chartreuse1' => '7fff00',
314            'chartreuse2' => '76ee00',
315            'chartreuse3' => '66cd00',
316            'chartreuse4' => '458b00',
317            'chocolate' => 'd2691e',
318            'chocolate1' => 'ff7f24',
319            'chocolate2' => 'ee7621',
320            'chocolate3' => 'cd661d',
321            'chocolate4' => '8b4513',
322            'coral' => 'ff7f50',
323            'coral1' => 'ff7256',
324            'coral2' => 'ee6a50',
325            'coral3' => 'cd5b45',
326            'coral4' => '8b3e2f',
327            'cornflowerblue' => '6495ed',
328            'cornsilk' => 'fff8dc',
329            'cornsilk1' => 'fff8dc',
330            'cornsilk2' => 'eee8cd',
331            'cornsilk3' => 'cdc8b1',
332            'cornsilk4' => '8b8878',
333            'crimson' => 'dc143c',
334            'cyan' => '00ffff',
335            'cyan1' => '00ffff',
336            'cyan2' => '00eeee',
337            'cyan3' => '00cdcd',
338            'cyan4' => '008b8b',
339            'darkgoldenrod' => 'b8860b',
340            'darkgoldenrod1' => 'ffb90f',
341            'darkgoldenrod2' => 'eead0e',
342            'darkgoldenrod3' => 'cd950c',
343            'darkgoldenrod4' => '8b6508',
344            'darkgreen' => '006400',
345            'darkkhaki' => 'bdb76b',
346            'darkolivegreen' => '556b2f',
347            'darkolivegreen1' => 'caff70',
348            'darkolivegreen2' => 'bcee68',
349            'darkolivegreen3' => 'a2cd5a',
350            'darkolivegreen4' => '6e8b3d',
351            'darkorange' => 'ff8c00',
352            'darkorange1' => 'ff7f00',
353            'darkorange2' => 'ee7600',
354            'darkorange3' => 'cd6600',
355            'darkorange4' => '8b4500',
356            'darkorchid' => '9932cc',
357            'darkorchid1' => 'bf3eff',
358            'darkorchid2' => 'b23aee',
359            'darkorchid3' => '9a32cd',
360            'darkorchid4' => '68228b',
361            'darksalmon' => 'e9967a',
362            'darkseagreen' => '8fbc8f',
363            'darkseagreen1' => 'c1ffc1',
364            'darkseagreen2' => 'b4eeb4',
365            'darkseagreen3' => '9bcd9b',
366            'darkseagreen4' => '698b69',
367            'darkslateblue' => '483d8b',
368            'darkslategray' => '2f4f4f',
369            'darkslategray1' => '97ffff',
370            'darkslategray2' => '8deeee',
371            'darkslategray3' => '79cdcd',
372            'darkslategray4' => '528b8b',
373            'darkslategrey' => '2f4f4f',
374            'darkturquoise' => '00ced1',
375            'darkviolet' => '9400d3',
376            'deeppink' => 'ff1493',
377            'deeppink1' => 'ff1493',
378            'deeppink2' => 'ee1289',
379            'deeppink3' => 'cd1076',
380            'deeppink4' => '8b0a50',
381            'deepskyblue' => '00bfff',
382            'deepskyblue1' => '00bfff',
383            'deepskyblue2' => '00b2ee',
384            'deepskyblue3' => '009acd',
385            'deepskyblue4' => '00688b',
386            'dimgray' => '696969',
387            'dimgrey' => '696969',
388            'dodgerblue' => '1e90ff',
389            'dodgerblue1' => '1e90ff',
390            'dodgerblue2' => '1c86ee',
391            'dodgerblue3' => '1874cd',
392            'dodgerblue4' => '104e8b',
393            'firebrick' => 'b22222',
394            'firebrick1' => 'ff3030',
395            'firebrick2' => 'ee2c2c',
396            'firebrick3' => 'cd2626',
397            'firebrick4' => '8b1a1a',
398            'floralwhite' => 'fffaf0',
399            'forestgreen' => '228b22',
400            'gainsboro' => 'dcdcdc',
401            'ghostwhite' => 'f8f8ff',
402            'gold' => 'ffd700',
403            'gold1' => 'ffd700',
404            'gold2' => 'eec900',
405            'gold3' => 'cdad00',
406            'gold4' => '8b7500',
407            'goldenrod' => 'daa520',
408            'goldenrod1' => 'ffc125',
409            'goldenrod2' => 'eeb422',
410            'goldenrod3' => 'cd9b1d',
411            'goldenrod4' => '8b6914',
412            'gray' => 'c0c0c0',
413            'gray0' => '000000',
414            'gray1' => '030303',
415            'gray2' => '050505',
416            'gray3' => '080808',
417            'gray4' => '0a0a0a',
418            'gray5' => '0d0d0d',
419            'gray6' => '0f0f0f',
420            'gray7' => '121212',
421            'gray8' => '141414',
422            'gray9' => '171717',
423            'gray10' => '1a1a1a',
424            'gray11' => '1c1c1c',
425            'gray12' => '1f1f1f',
426            'gray13' => '212121',
427            'gray14' => '242424',
428            'gray15' => '262626',
429            'gray16' => '292929',
430            'gray17' => '2b2b2b',
431            'gray18' => '2e2e2e',
432            'gray19' => '303030',
433            'gray20' => '333333',
434            'gray21' => '363636',
435            'gray22' => '383838',
436            'gray23' => '3b3b3b',
437            'gray24' => '3d3d3d',
438            'gray25' => '404040',
439            'gray26' => '424242',
440            'gray27' => '454545',
441            'gray28' => '474747',
442            'gray29' => '4a4a4a',
443            'gray30' => '4d4d4d',
444            'gray31' => '4f4f4f',
445            'gray32' => '525252',
446            'gray33' => '545454',
447            'gray34' => '575757',
448            'gray35' => '595959',
449            'gray36' => '5c5c5c',
450            'gray37' => '5e5e5e',
451            'gray38' => '616161',
452            'gray39' => '636363',
453            'gray40' => '666666',
454            'gray41' => '696969',
455            'gray42' => '6b6b6b',
456            'gray43' => '6e6e6e',
457            'gray44' => '707070',
458            'gray45' => '737373',
459            'gray46' => '757575',
460            'gray47' => '787878',
461            'gray48' => '7a7a7a',
462            'gray49' => '7d7d7d',
463            'gray50' => '7f7f7f',
464            'gray51' => '828282',
465            'gray52' => '858585',
466            'gray53' => '878787',
467            'gray54' => '8a8a8a',
468            'gray55' => '8c8c8c',
469            'gray56' => '8f8f8f',
470            'gray57' => '919191',
471            'gray58' => '949494',
472            'gray59' => '969696',
473            'gray60' => '999999',
474            'gray61' => '9c9c9c',
475            'gray62' => '9e9e9e',
476            'gray63' => 'a1a1a1',
477            'gray64' => 'a3a3a3',
478            'gray65' => 'a6a6a6',
479            'gray66' => 'a8a8a8',
480            'gray67' => 'ababab',
481            'gray68' => 'adadad',
482            'gray69' => 'b0b0b0',
483            'gray70' => 'b3b3b3',
484            'gray71' => 'b5b5b5',
485            'gray72' => 'b8b8b8',
486            'gray73' => 'bababa',
487            'gray74' => 'bdbdbd',
488            'gray75' => 'bfbfbf',
489            'gray76' => 'c2c2c2',
490            'gray77' => 'c4c4c4',
491            'gray78' => 'c7c7c7',
492            'gray79' => 'c9c9c9',
493            'gray80' => 'cccccc',
494            'gray81' => 'cfcfcf',
495            'gray82' => 'd1d1d1',
496            'gray83' => 'd4d4d4',
497            'gray84' => 'd6d6d6',
498            'gray85' => 'd9d9d9',
499            'gray86' => 'dbdbdb',
500            'gray87' => 'dedede',
501            'gray88' => 'e0e0e0',
502            'gray89' => 'e3e3e3',
503            'gray90' => 'e5e5e5',
504            'gray91' => 'e8e8e8',
505            'gray92' => 'ebebeb',
506            'gray93' => 'ededed',
507            'gray94' => 'f0f0f0',
508            'gray95' => 'f2f2f2',
509            'gray96' => 'f5f5f5',
510            'gray97' => 'f7f7f7',
511            'gray98' => 'fafafa',
512            'gray99' => 'fcfcfc',
513            'gray100' => 'ffffff',
514            'green' => '00ff00',
515            'green1' => '00ff00',
516            'green2' => '00ee00',
517            'green3' => '00cd00',
518            'green4' => '008b00',
519            'greenyellow' => 'adff2f',
520            'grey' => 'c0c0c0',
521            'grey0' => '000000',
522            'grey1' => '030303',
523            'grey2' => '050505',
524            'grey3' => '080808',
525            'grey4' => '0a0a0a',
526            'grey5' => '0d0d0d',
527            'grey6' => '0f0f0f',
528            'grey7' => '121212',
529            'grey8' => '141414',
530            'grey9' => '171717',
531            'grey10' => '1a1a1a',
532            'grey11' => '1c1c1c',
533            'grey12' => '1f1f1f',
534            'grey13' => '212121',
535            'grey14' => '242424',
536            'grey15' => '262626',
537            'grey16' => '292929',
538            'grey17' => '2b2b2b',
539            'grey18' => '2e2e2e',
540            'grey19' => '303030',
541            'grey20' => '333333',
542            'grey21' => '363636',
543            'grey22' => '383838',
544            'grey23' => '3b3b3b',
545            'grey24' => '3d3d3d',
546            'grey25' => '404040',
547            'grey26' => '424242',
548            'grey27' => '454545',
549            'grey28' => '474747',
550            'grey29' => '4a4a4a',
551            'grey30' => '4d4d4d',
552            'grey31' => '4f4f4f',
553            'grey32' => '525252',
554            'grey33' => '545454',
555            'grey34' => '575757',
556            'grey35' => '595959',
557            'grey36' => '5c5c5c',
558            'grey37' => '5e5e5e',
559            'grey38' => '616161',
560            'grey39' => '636363',
561            'grey40' => '666666',
562            'grey41' => '696969',
563            'grey42' => '6b6b6b',
564            'grey43' => '6e6e6e',
565            'grey44' => '707070',
566            'grey45' => '737373',
567            'grey46' => '757575',
568            'grey47' => '787878',
569            'grey48' => '7a7a7a',
570            'grey49' => '7d7d7d',
571            'grey50' => '7f7f7f',
572            'grey51' => '828282',
573            'grey52' => '858585',
574            'grey53' => '878787',
575            'grey54' => '8a8a8a',
576            'grey55' => '8c8c8c',
577            'grey56' => '8f8f8f',
578            'grey57' => '919191',
579            'grey58' => '949494',
580            'grey59' => '969696',
581            'grey60' => '999999',
582            'grey61' => '9c9c9c',
583            'grey62' => '9e9e9e',
584            'grey63' => 'a1a1a1',
585            'grey64' => 'a3a3a3',
586            'grey65' => 'a6a6a6',
587            'grey66' => 'a8a8a8',
588            'grey67' => 'ababab',
589            'grey68' => 'adadad',
590            'grey69' => 'b0b0b0',
591            'grey70' => 'b3b3b3',
592            'grey71' => 'b5b5b5',
593            'grey72' => 'b8b8b8',
594            'grey73' => 'bababa',
595            'grey74' => 'bdbdbd',
596            'grey75' => 'bfbfbf',
597            'grey76' => 'c2c2c2',
598            'grey77' => 'c4c4c4',
599            'grey78' => 'c7c7c7',
600            'grey79' => 'c9c9c9',
601            'grey80' => 'cccccc',
602            'grey81' => 'cfcfcf',
603            'grey82' => 'd1d1d1',
604            'grey83' => 'd4d4d4',
605            'grey84' => 'd6d6d6',
606            'grey85' => 'd9d9d9',
607            'grey86' => 'dbdbdb',
608            'grey87' => 'dedede',
609            'grey88' => 'e0e0e0',
610            'grey89' => 'e3e3e3',
611            'grey90' => 'e5e5e5',
612            'grey91' => 'e8e8e8',
613            'grey92' => 'ebebeb',
614            'grey93' => 'ededed',
615            'grey94' => 'f0f0f0',
616            'grey95' => 'f2f2f2',
617            'grey96' => 'f5f5f5',
618            'grey97' => 'f7f7f7',
619            'grey98' => 'fafafa',
620            'grey99' => 'fcfcfc',
621            'grey100' => 'ffffff',
622            'honeydew' => 'f0fff0',
623            'honeydew1' => 'f0fff0',
624            'honeydew2' => 'e0eee0',
625            'honeydew3' => 'c1cdc1',
626            'honeydew4' => '838b83',
627            'hotpink' => 'ff69b4',
628            'hotpink1' => 'ff6eb4',
629            'hotpink2' => 'ee6aa7',
630            'hotpink3' => 'cd6090',
631            'hotpink4' => '8b3a62',
632            'indianred' => 'cd5c5c',
633            'indianred1' => 'ff6a6a',
634            'indianred2' => 'ee6363',
635            'indianred3' => 'cd5555',
636            'indianred4' => '8b3a3a',
637            'indigo' => '4b0082',
638            'ivory' => 'fffff0',
639            'ivory1' => 'fffff0',
640            'ivory2' => 'eeeee0',
641            'ivory3' => 'cdcdc1',
642            'ivory4' => '8b8b83',
643            'khaki' => 'f0e68c',
644            'khaki1' => 'fff68f',
645            'khaki2' => 'eee685',
646            'khaki3' => 'cdc673',
647            'khaki4' => '8b864e',
648            'lavender' => 'e6e6fa',
649            'lavenderblush' => 'fff0f5',
650            'lavenderblush1' => 'fff0f5',
651            'lavenderblush2' => 'eee0e5',
652            'lavenderblush3' => 'cdc1c5',
653            'lavenderblush4' => '8b8386',
654            'lawngreen' => '7cfc00',
655            'lemonchiffon' => 'fffacd',
656            'lemonchiffon1' => 'fffacd',
657            'lemonchiffon2' => 'eee9bf',
658            'lemonchiffon3' => 'cdc9a5',
659            'lemonchiffon4' => '8b8970',
660            'lightblue' => 'add8e6',
661            'lightblue1' => 'bfefff',
662            'lightblue2' => 'b2dfee',
663            'lightblue3' => '9ac0cd',
664            'lightblue4' => '68838b',
665            'lightcoral' => 'f08080',
666            'lightcyan' => 'e0ffff',
667            'lightcyan1' => 'e0ffff',
668            'lightcyan2' => 'd1eeee',
669            'lightcyan3' => 'b4cdcd',
670            'lightcyan4' => '7a8b8b',
671            'lightgoldenrod' => 'eedd82',
672            'lightgoldenrod1' => 'ffec8b',
673            'lightgoldenrod2' => 'eedc82',
674            'lightgoldenrod3' => 'cdbe70',
675            'lightgoldenrod4' => '8b814c',
676            'lightgoldenrodyellow' => 'fafad2',
677            'lightgray' => 'd3d3d3',
678            'lightgrey' => 'd3d3d3',
679            'lightpink' => 'ffb6c1',
680            'lightpink1' => 'ffaeb9',
681            'lightpink2' => 'eea2ad',
682            'lightpink3' => 'cd8c95',
683            'lightpink4' => '8b5f65',
684            'lightsalmon' => 'ffa07a',
685            'lightsalmon1' => 'ffa07a',
686            'lightsalmon2' => 'ee9572',
687            'lightsalmon3' => 'cd8162',
688            'lightsalmon4' => '8b5742',
689            'lightseagreen' => '20b2aa',
690            'lightskyblue' => '87cefa',
691            'lightskyblue1' => 'b0e2ff',
692            'lightskyblue2' => 'a4d3ee',
693            'lightskyblue3' => '8db6cd',
694            'lightskyblue4' => '607b8b',
695            'lightslateblue' => '8470ff',
696            'lightslategray' => '778899',
697            'lightslategrey' => '778899',
698            'lightsteelblue' => 'b0c4de',
699            'lightsteelblue1' => 'cae1ff',
700            'lightsteelblue2' => 'bcd2ee',
701            'lightsteelblue3' => 'a2b5cd',
702            'lightsteelblue4' => '6e7b8b',
703            'lightyellow' => 'ffffe0',
704            'lightyellow1' => 'ffffe0',
705            'lightyellow2' => 'eeeed1',
706            'lightyellow3' => 'cdcdb4',
707            'lightyellow4' => '8b8b7a',
708            'limegreen' => '32cd32',
709            'linen' => 'faf0e6',
710            'magenta' => 'ff00ff',
711            'magenta1' => 'ff00ff',
712            'magenta2' => 'ee00ee',
713            'magenta3' => 'cd00cd',
714            'magenta4' => '8b008b',
715            'maroon' => 'b03060',
716            'maroon1' => 'ff34b3',
717            'maroon2' => 'ee30a7',
718            'maroon3' => 'cd2990',
719            'maroon4' => '8b1c62',
720            'mediumaquamarine' => '66cdaa',
721            'mediumblue' => '0000cd',
722            'mediumorchid' => 'ba55d3',
723            'mediumorchid1' => 'e066ff',
724            'mediumorchid2' => 'd15fee',
725            'mediumorchid3' => 'b452cd',
726            'mediumorchid4' => '7a378b',
727            'mediumpurple' => '9370db',
728            'mediumpurple1' => 'ab82ff',
729            'mediumpurple2' => '9f79ee',
730            'mediumpurple3' => '8968cd',
731            'mediumpurple4' => '5d478b',
732            'mediumseagreen' => '3cb371',
733            'mediumslateblue' => '7b68ee',
734            'mediumspringgreen' => '00fa9a',
735            'mediumturquoise' => '48d1cc',
736            'mediumvioletred' => 'c71585',
737            'midnightblue' => '191970',
738            'mintcream' => 'f5fffa',
739            'mistyrose' => 'ffe4e1',
740            'mistyrose1' => 'ffe4e1',
741            'mistyrose2' => 'eed5d2',
742            'mistyrose3' => 'cdb7b5',
743            'mistyrose4' => '8b7d7b',
744            'moccasin' => 'ffe4b5',
745            'navajowhite' => 'ffdead',
746            'navajowhite1' => 'ffdead',
747            'navajowhite2' => 'eecfa1',
748            'navajowhite3' => 'cdb38b',
749            'navajowhite4' => '8b795e',
750            'navy' => '000080',
751            'navyblue' => '000080',
752            'oldlace' => 'fdf5e6',
753            'olivedrab' => '6b8e23',
754            'olivedrab1' => 'c0ff3e',
755            'olivedrab2' => 'b3ee3a',
756            'olivedrab3' => '9acd32',
757            'olivedrab4' => '698b22',
758            'orange' => 'ffa500',
759            'orange1' => 'ffa500',
760            'orange2' => 'ee9a00',
761            'orange3' => 'cd8500',
762            'orange4' => '8b5a00',
763            'orangered' => 'ff4500',
764            'orangered1' => 'ff4500',
765            'orangered2' => 'ee4000',
766            'orangered3' => 'cd3700',
767            'orangered4' => '8b2500',
768            'orchid' => 'da70d6',
769            'orchid1' => 'ff83fa',
770            'orchid2' => 'ee7ae9',
771            'orchid3' => 'cd69c9',
772            'orchid4' => '8b4789',
773            'palegoldenrod' => 'eee8aa',
774            'palegreen' => '98fb98',
775            'palegreen1' => '9aff9a',
776            'palegreen2' => '90ee90',
777            'palegreen3' => '7ccd7c',
778            'palegreen4' => '548b54',
779            'paleturquoise' => 'afeeee',
780            'paleturquoise1' => 'bbffff',
781            'paleturquoise2' => 'aeeeee',
782            'paleturquoise3' => '96cdcd',
783            'paleturquoise4' => '668b8b',
784            'palevioletred' => 'db7093',
785            'palevioletred1' => 'ff82ab',
786            'palevioletred2' => 'ee799f',
787            'palevioletred3' => 'cd6889',
788            'palevioletred4' => '8b475d',
789            'papayawhip' => 'ffefd5',
790            'peachpuff' => 'ffdab9',
791            'peachpuff1' => 'ffdab9',
792            'peachpuff2' => 'eecbad',
793            'peachpuff3' => 'cdaf95',
794            'peachpuff4' => '8b7765',
795            'peru' => 'cd853f',
796            'pink' => 'ffc0cb',
797            'pink1' => 'ffb5c5',
798            'pink2' => 'eea9b8',
799            'pink3' => 'cd919e',
800            'pink4' => '8b636c',
801            'plum' => 'dda0dd',
802            'plum1' => 'ffbbff',
803            'plum2' => 'eeaeee',
804            'plum3' => 'cd96cd',
805            'plum4' => '8b668b',
806            'powderblue' => 'b0e0e6',
807            'purple' => 'a020f0',
808            'purple1' => '9b30ff',
809            'purple2' => '912cee',
810            'purple3' => '7d26cd',
811            'purple4' => '551a8b',
812            'red' => 'ff0000',
813            'red1' => 'ff0000',
814            'red2' => 'ee0000',
815            'red3' => 'cd0000',
816            'red4' => '8b0000',
817            'rosybrown' => 'bc8f8f',
818            'rosybrown1' => 'ffc1c1',
819            'rosybrown2' => 'eeb4b4',
820            'rosybrown3' => 'cd9b9b',
821            'rosybrown4' => '8b6969',
822            'royalblue' => '4169e1',
823            'royalblue1' => '4876ff',
824            'royalblue2' => '436eee',
825            'royalblue3' => '3a5fcd',
826            'royalblue4' => '27408b',
827            'saddlebrown' => '8b4513',
828            'salmon' => 'fa8072',
829            'salmon1' => 'ff8c69',
830            'salmon2' => 'ee8262',
831            'salmon3' => 'cd7054',
832            'salmon4' => '8b4c39',
833            'sandybrown' => 'f4a460',
834            'seagreen' => '2e8b57',
835            'seagreen1' => '54ff9f',
836            'seagreen2' => '4eee94',
837            'seagreen3' => '43cd80',
838            'seagreen4' => '2e8b57',
839            'seashell' => 'fff5ee',
840            'seashell1' => 'fff5ee',
841            'seashell2' => 'eee5de',
842            'seashell3' => 'cdc5bf',
843            'seashell4' => '8b8682',
844            'sienna' => 'a0522d',
845            'sienna1' => 'ff8247',
846            'sienna2' => 'ee7942',
847            'sienna3' => 'cd6839',
848            'sienna4' => '8b4726',
849            'skyblue' => '87ceeb',
850            'skyblue1' => '87ceff',
851            'skyblue2' => '7ec0ee',
852            'skyblue3' => '6ca6cd',
853            'skyblue4' => '4a708b',
854            'slateblue' => '6a5acd',
855            'slateblue1' => '836fff',
856            'slateblue2' => '7a67ee',
857            'slateblue3' => '6959cd',
858            'slateblue4' => '473c8b',
859            'slategray' => '708090',
860            'slategray1' => 'c6e2ff',
861            'slategray2' => 'b9d3ee',
862            'slategray3' => '9fb6cd',
863            'slategray4' => '6c7b8b',
864            'slategrey' => '708090',
865            'snow' => 'fffafa',
866            'snow1' => 'fffafa',
867            'snow2' => 'eee9e9',
868            'snow3' => 'cdc9c9',
869            'snow4' => '8b8989',
870            'springgreen' => '00ff7f',
871            'springgreen1' => '00ff7f',
872            'springgreen2' => '00ee76',
873            'springgreen3' => '00cd66',
874            'springgreen4' => '008b45',
875            'steelblue' => '4682b4',
876            'steelblue1' => '63b8ff',
877            'steelblue2' => '5cacee',
878            'steelblue3' => '4f94cd',
879            'steelblue4' => '36648b',
880            'tan' => 'd2b48c',
881            'tan1' => 'ffa54f',
882            'tan2' => 'ee9a49',
883            'tan3' => 'cd853f',
884            'tan4' => '8b5a2b',
885            'thistle' => 'd8bfd8',
886            'thistle1' => 'ffe1ff',
887            'thistle2' => 'eed2ee',
888            'thistle3' => 'cdb5cd',
889            'thistle4' => '8b7b8b',
890            'tomato' => 'ff6347',
891            'tomato1' => 'ff6347',
892            'tomato2' => 'ee5c42',
893            'tomato3' => 'cd4f39',
894            'tomato4' => '8b3626',
895            'transparent' => 'fffffe',
896            'turquoise' => '40e0d0',
897            'turquoise1' => '00f5ff',
898            'turquoise2' => '00e5ee',
899            'turquoise3' => '00c5cd',
900            'turquoise4' => '00868b',
901            'violet' => 'ee82ee',
902            'violetred' => 'd02090',
903            'violetred1' => 'ff3e96',
904            'violetred2' => 'ee3a8c',
905            'violetred3' => 'cd3278',
906            'violetred4' => '8b2252',
907            'wheat' => 'f5deb3',
908            'wheat1' => 'ffe7ba',
909            'wheat2' => 'eed8ae',
910            'wheat3' => 'cdba96',
911            'wheat4' => '8b7e66',
912            'white' => 'ffffff',
913            'whitesmoke' => 'f5f5f5',
914            'yellow' => 'ffff00',
915            'yellow1' => 'ffff00',
916            'yellow2' => 'eeee00',
917            'yellow3' => 'cdcd00',
918            'yellow4' => '8b8b00',
919            'yellowgreen' => '9acd32'
920        );
921    }
922}
923
924