1    
2    /* ====================================================================
3     * The Apache Software License, Version 1.1
4     *
5     * Copyright (c) 2002 The Apache Software Foundation.  All rights
6     * reserved.
7     *
8     * Redistribution and use in source and binary forms, with or without
9     * modification, are permitted provided that the following conditions
10    * are met:
11    *
12    * 1. Redistributions of source code must retain the above copyright
13    *    notice, this list of conditions and the following disclaimer.
14    *
15    * 2. Redistributions in binary form must reproduce the above copyright
16    *    notice, this list of conditions and the following disclaimer in
17    *    the documentation and/or other materials provided with the
18    *    distribution.
19    *
20    * 3. The end-user documentation included with the redistribution,
21    *    if any, must include the following acknowledgment:
22    *       "This product includes software developed by the
23    *        Apache Software Foundation (http://www.apache.org/)."
24    *    Alternately, this acknowledgment may appear in the software itself,
25    *    if and wherever such third-party acknowledgments normally appear.
26    *
27    * 4. The names "Apache" and "Apache Software Foundation" and
28    *    "Apache POI" must not be used to endorse or promote products
29    *    derived from this software without prior written permission. For
30    *    written permission, please contact apache@apache.org.
31    *
32    * 5. Products derived from this software may not be called "Apache",
33    *    "Apache POI", nor may "Apache" appear in their name, without
34    *    prior written permission of the Apache Software Foundation.
35    *
36    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47    * SUCH DAMAGE.
48    * ====================================================================
49    *
50    * This software consists of voluntary contributions made by many
51    * individuals on behalf of the Apache Software Foundation.  For more
52    * information on the Apache Software Foundation, please see
53    * <http://www.apache.org/>.
54    */
55   
56   package org.apache.poi.hssf.util;
57   
58   import java.util.*;
59   
60   /**
61    * Intends to provide support for the very evil index to triplet issue and
62    * will likely replace the color contants interface for HSSF 2.0.
63    * This class contains static inner class members for representing colors.
64    * Each color has an index (for the standard palette in Excel (tm) ),
65    * native (RGB) triplet and string triplet.  The string triplet is as the
66    * color would be represented by Gnumeric.  Having (string) this here is a bit of a
67    * collusion of function between HSSF and the HSSFSerializer but I think its
68    * a reasonable one in this case.
69    *
70    * @author  Andrew C. Oliver (acoliver at apache dot org)
71    * @author  Brian Sanders (bsanders at risklabs dot com) - full default color palette
72    */
73   
74   public class HSSFColor
75   {
76       private final static int PALETTE_SIZE = 56;
77       private final static int DISTINCT_COLOR_COUNT = 46;
78   
79       /** Creates a new instance of HSSFColor */
80   
81       public HSSFColor()
82       {
83       }
84   
85       /**
86        * this function returns all colors in a hastable.  Its not implemented as a
87        * static member/staticly initialized because that would be dirty in a
88        * server environment as it is intended.  This means you'll eat the time
89        * it takes to create it once per request but you will not hold onto it
90        * if you have none of those requests.
91        *
92        * @return a hashtable containing all colors mapped to their excel-style 
93        * pallette index
94        */
95       public final static Hashtable getIndexHash() {
96   
97           Hashtable hash = new Hashtable(PALETTE_SIZE);
98   
99           hash.put(new Integer(HSSFColor.BLACK.index), new HSSFColor.BLACK());
100          hash.put(new Integer(HSSFColor.BROWN.index), new HSSFColor.BROWN());
101          hash.put(new Integer(HSSFColor.OLIVE_GREEN.index),
102                   new HSSFColor.OLIVE_GREEN());
103          hash.put(new Integer(HSSFColor.DARK_GREEN.index), new HSSFColor.DARK_GREEN());
104          hash.put(new Integer(HSSFColor.DARK_TEAL.index), new HSSFColor.DARK_TEAL());
105          hash.put(new Integer(HSSFColor.DARK_BLUE.index), new HSSFColor.DARK_BLUE());
106          hash.put(new Integer(HSSFColor.DARK_BLUE.index2), new HSSFColor.DARK_BLUE());
107          hash.put(new Integer(HSSFColor.INDIGO.index), new HSSFColor.INDIGO());
108          hash.put(new Integer(HSSFColor.GREY_80_PERCENT.index),
109                   new HSSFColor.GREY_80_PERCENT());
110          hash.put(new Integer(HSSFColor.ORANGE.index), new HSSFColor.ORANGE());
111          hash.put(new Integer(HSSFColor.DARK_YELLOW.index),
112                   new HSSFColor.DARK_YELLOW());
113          hash.put(new Integer(HSSFColor.GREEN.index), new HSSFColor.GREEN());
114          hash.put(new Integer(HSSFColor.TEAL.index), new HSSFColor.TEAL());
115          hash.put(new Integer(HSSFColor.TEAL.index2), new HSSFColor.TEAL());
116          hash.put(new Integer(HSSFColor.BLUE.index), new HSSFColor.BLUE());
117          hash.put(new Integer(HSSFColor.BLUE.index2), new HSSFColor.BLUE());
118          hash.put(new Integer(HSSFColor.BLUE_GREY.index), new HSSFColor.BLUE_GREY());
119          hash.put(new Integer(HSSFColor.GREY_50_PERCENT.index),
120                   new HSSFColor.GREY_50_PERCENT());
121          hash.put(new Integer(HSSFColor.RED.index), new HSSFColor.RED());
122          hash.put(new Integer(HSSFColor.LIGHT_ORANGE.index),
123                   new HSSFColor.LIGHT_ORANGE());
124          hash.put(new Integer(HSSFColor.LIME.index), new HSSFColor.LIME());
125          hash.put(new Integer(HSSFColor.SEA_GREEN.index), new HSSFColor.SEA_GREEN());
126          hash.put(new Integer(HSSFColor.AQUA.index), new HSSFColor.AQUA());
127          hash.put(new Integer(HSSFColor.LIGHT_BLUE.index), new HSSFColor.LIGHT_BLUE());
128          hash.put(new Integer(HSSFColor.VIOLET.index), new HSSFColor.VIOLET());
129          hash.put(new Integer(HSSFColor.VIOLET.index2), new HSSFColor.VIOLET());
130          hash.put(new Integer(HSSFColor.GREY_40_PERCENT.index),
131                   new HSSFColor.GREY_40_PERCENT());
132          hash.put(new Integer(HSSFColor.PINK.index), new HSSFColor.PINK());
133          hash.put(new Integer(HSSFColor.PINK.index2), new HSSFColor.PINK());
134          hash.put(new Integer(HSSFColor.GOLD.index), new HSSFColor.GOLD());
135          hash.put(new Integer(HSSFColor.YELLOW.index), new HSSFColor.YELLOW());
136          hash.put(new Integer(HSSFColor.YELLOW.index2), new HSSFColor.YELLOW());
137          hash.put(new Integer(HSSFColor.BRIGHT_GREEN.index),
138                   new HSSFColor.BRIGHT_GREEN());
139          hash.put(new Integer(HSSFColor.BRIGHT_GREEN.index2),
140                   new HSSFColor.BRIGHT_GREEN());
141          hash.put(new Integer(HSSFColor.TURQUOISE.index), new HSSFColor.TURQUOISE());
142          hash.put(new Integer(HSSFColor.TURQUOISE.index2), new HSSFColor.TURQUOISE());
143          hash.put(new Integer(HSSFColor.DARK_RED.index), new HSSFColor.DARK_RED());
144          hash.put(new Integer(HSSFColor.DARK_RED.index2), new HSSFColor.DARK_RED());
145          hash.put(new Integer(HSSFColor.SKY_BLUE.index), new HSSFColor.SKY_BLUE());
146          hash.put(new Integer(HSSFColor.PLUM.index), new HSSFColor.PLUM());
147          hash.put(new Integer(HSSFColor.PLUM.index2), new HSSFColor.PLUM());
148          hash.put(new Integer(HSSFColor.GREY_25_PERCENT.index),
149                   new HSSFColor.GREY_25_PERCENT());
150          hash.put(new Integer(HSSFColor.ROSE.index), new HSSFColor.ROSE());
151          hash.put(new Integer(HSSFColor.LIGHT_YELLOW.index),
152                   new HSSFColor.LIGHT_YELLOW());
153          hash.put(new Integer(HSSFColor.LIGHT_GREEN.index),
154                   new HSSFColor.LIGHT_GREEN());
155          hash.put(new Integer(HSSFColor.LIGHT_TURQUOISE.index),
156                   new HSSFColor.LIGHT_TURQUOISE());
157          hash.put(new Integer(HSSFColor.LIGHT_TURQUOISE.index2),
158                   new HSSFColor.LIGHT_TURQUOISE());
159          hash.put(new Integer(HSSFColor.PALE_BLUE.index), new HSSFColor.PALE_BLUE());
160          hash.put(new Integer(HSSFColor.LAVENDER.index), new HSSFColor.LAVENDER());
161          hash.put(new Integer(HSSFColor.WHITE.index), new HSSFColor.WHITE());
162          hash.put(new Integer(HSSFColor.CORNFLOWER_BLUE.index),
163                   new HSSFColor.CORNFLOWER_BLUE());
164          hash.put(new Integer(HSSFColor.LEMON_CHIFFON.index),
165                   new HSSFColor.LEMON_CHIFFON());
166          hash.put(new Integer(HSSFColor.MAROON.index), new HSSFColor.MAROON());
167          hash.put(new Integer(HSSFColor.ORCHID.index), new HSSFColor.ORCHID());
168          hash.put(new Integer(HSSFColor.CORAL.index), new HSSFColor.CORAL());
169          hash.put(new Integer(HSSFColor.ROYAL_BLUE.index), new HSSFColor.ROYAL_BLUE());
170          hash.put(new Integer(HSSFColor.LIGHT_CORNFLOWER_BLUE.index),
171                   new HSSFColor.LIGHT_CORNFLOWER_BLUE());
172  	return hash;
173      }
174  
175      /**
176       * this function returns all colors in a hastable.  Its not implemented as a
177       * static member/staticly initialized because that would be dirty in a
178       * server environment as it is intended.  This means you'll eat the time
179       * it takes to create it once per request but you will not hold onto it
180       * if you have none of those requests.
181       *
182       * @return a hashtable containing all colors mapped to their gnumeric-like
183       * triplet string
184       */
185  
186      public final static Hashtable getTripletHash()
187      {
188          Hashtable hash = new Hashtable(DISTINCT_COLOR_COUNT);
189  
190          hash.put(HSSFColor.BLACK.hexString, new HSSFColor.BLACK());
191          hash.put(HSSFColor.BROWN.hexString, new HSSFColor.BROWN());
192          hash.put(HSSFColor.OLIVE_GREEN.hexString,
193                   new HSSFColor.OLIVE_GREEN());
194          hash.put(HSSFColor.DARK_GREEN.hexString, new HSSFColor.DARK_GREEN());
195          hash.put(HSSFColor.DARK_TEAL.hexString, new HSSFColor.DARK_TEAL());
196          hash.put(HSSFColor.DARK_BLUE.hexString, new HSSFColor.DARK_BLUE());
197          hash.put(HSSFColor.INDIGO.hexString, new HSSFColor.INDIGO());
198          hash.put(HSSFColor.GREY_80_PERCENT.hexString,
199                   new HSSFColor.GREY_80_PERCENT());
200          hash.put(HSSFColor.ORANGE.hexString, new HSSFColor.ORANGE());
201          hash.put(HSSFColor.DARK_YELLOW.hexString,
202                   new HSSFColor.DARK_YELLOW());
203          hash.put(HSSFColor.GREEN.hexString, new HSSFColor.GREEN());
204          hash.put(HSSFColor.TEAL.hexString, new HSSFColor.TEAL());
205          hash.put(HSSFColor.BLUE.hexString, new HSSFColor.BLUE());
206          hash.put(HSSFColor.BLUE_GREY.hexString, new HSSFColor.BLUE_GREY());
207          hash.put(HSSFColor.GREY_50_PERCENT.hexString,
208                   new HSSFColor.GREY_50_PERCENT());
209          hash.put(HSSFColor.RED.hexString, new HSSFColor.RED());
210          hash.put(HSSFColor.LIGHT_ORANGE.hexString,
211                   new HSSFColor.LIGHT_ORANGE());
212          hash.put(HSSFColor.LIME.hexString, new HSSFColor.LIME());
213          hash.put(HSSFColor.SEA_GREEN.hexString, new HSSFColor.SEA_GREEN());
214          hash.put(HSSFColor.AQUA.hexString, new HSSFColor.AQUA());
215          hash.put(HSSFColor.LIGHT_BLUE.hexString, new HSSFColor.LIGHT_BLUE());
216          hash.put(HSSFColor.VIOLET.hexString, new HSSFColor.VIOLET());
217          hash.put(HSSFColor.GREY_40_PERCENT.hexString,
218                   new HSSFColor.GREY_40_PERCENT());
219          hash.put(HSSFColor.PINK.hexString, new HSSFColor.PINK());
220          hash.put(HSSFColor.GOLD.hexString, new HSSFColor.GOLD());
221          hash.put(HSSFColor.YELLOW.hexString, new HSSFColor.YELLOW());
222          hash.put(HSSFColor.BRIGHT_GREEN.hexString,
223                   new HSSFColor.BRIGHT_GREEN());
224          hash.put(HSSFColor.BRIGHT_GREEN.hexString, new HSSFColor.TURQUOISE());
225          hash.put(HSSFColor.DARK_RED.hexString, new HSSFColor.DARK_RED());
226          hash.put(HSSFColor.SKY_BLUE.hexString, new HSSFColor.SKY_BLUE());
227          hash.put(HSSFColor.PLUM.hexString, new HSSFColor.PLUM());
228          hash.put(HSSFColor.GREY_25_PERCENT.hexString,
229                   new HSSFColor.GREY_25_PERCENT());
230          hash.put(HSSFColor.ROSE.hexString, new HSSFColor.ROSE());
231          hash.put(HSSFColor.LIGHT_YELLOW.hexString,
232                   new HSSFColor.LIGHT_YELLOW());
233          hash.put(HSSFColor.LIGHT_GREEN.hexString,
234                   new HSSFColor.LIGHT_GREEN());
235          hash.put(HSSFColor.LIGHT_TURQUOISE.hexString,
236                   new HSSFColor.LIGHT_TURQUOISE());
237          hash.put(HSSFColor.PALE_BLUE.hexString, new HSSFColor.PALE_BLUE());
238          hash.put(HSSFColor.LAVENDER.hexString, new HSSFColor.LAVENDER());
239          hash.put(HSSFColor.WHITE.hexString, new HSSFColor.WHITE());
240          hash.put(HSSFColor.CORNFLOWER_BLUE.hexString, new HSSFColor.CORNFLOWER_BLUE());
241          hash.put(HSSFColor.LEMON_CHIFFON.hexString, new HSSFColor.LEMON_CHIFFON());
242          hash.put(HSSFColor.MAROON.hexString, new HSSFColor.MAROON());
243          hash.put(HSSFColor.ORCHID.hexString, new HSSFColor.ORCHID());
244          hash.put(HSSFColor.CORAL.hexString, new HSSFColor.CORAL());
245          hash.put(HSSFColor.ROYAL_BLUE.hexString, new HSSFColor.ROYAL_BLUE());
246          hash.put(HSSFColor.LIGHT_CORNFLOWER_BLUE.hexString,
247                   new HSSFColor.LIGHT_CORNFLOWER_BLUE());
248          return hash;
249      }
250  
251      /**
252       * @return index to the standard palette
253       */
254  
255      public short getIndex()
256      {
257          return BLACK.index;
258      }
259  
260      /**
261       * @return  triplet representation like that in Excel
262       */
263  
264      public short [] getTriplet()
265      {
266          return BLACK.triplet;
267      }
268  
269      // its a hack but its a good hack
270  
271      /**
272       * @return a hex string exactly like a gnumeric triplet
273       */
274  
275      public String getHexString()
276      {
277          return BLACK.hexString;
278      }
279  
280      /**
281       * Class BLACK
282       *
283       */
284  
285      public final static class BLACK
286          extends HSSFColor
287      {
288          public final static short   index     = 0x8;
289          public final static short[] triplet   =
290          {
291              0, 0, 0
292          };
293          public final static String  hexString = "0:0:0";
294  
295          public short getIndex()
296          {
297              return index;
298          }
299  
300          public short [] getTriplet()
301          {
302              return triplet;
303          }
304  
305          public String getHexString()
306          {
307              return hexString;
308          }
309      }
310  
311      /**
312       * Class BROWN
313       *
314       */
315  
316      public final static class BROWN
317          extends HSSFColor
318      {
319          public final static short   index     = 0x3c;
320          public final static short[] triplet   =
321          {
322              153, 51, 0
323          };
324          public final static String  hexString = "9999:3333:0";
325  
326          public short getIndex()
327          {
328              return index;
329          }
330  
331          public short [] getTriplet()
332          {
333              return triplet;
334          }
335  
336          public String getHexString()
337          {
338              return hexString;
339          }
340      }
341  
342      /**
343       * Class OLIVE_GREEN
344       *
345       */
346  
347      public static class OLIVE_GREEN
348          extends HSSFColor
349      {
350          public final static short   index     = 0x3b;
351          public final static short[] triplet   =
352          {
353              51, 51, 0
354          };
355          public final static String  hexString = "3333:3333:0";
356  
357          public short getIndex()
358          {
359              return index;
360          }
361  
362          public short [] getTriplet()
363          {
364              return triplet;
365          }
366  
367          public String getHexString()
368          {
369              return hexString;
370          }
371      }
372  
373      /**
374       * Class DARK_GREEN
375       *
376       */
377  
378      public final static class DARK_GREEN
379          extends HSSFColor
380      {
381          public final static short   index     = 0x3a;
382          public final static short[] triplet   =
383          {
384              0, 51, 0
385          };
386          public final static String  hexString = "0:3333:0";
387  
388          public short getIndex()
389          {
390              return index;
391          }
392  
393          public short [] getTriplet()
394          {
395              return triplet;
396          }
397  
398          public String getHexString()
399          {
400              return hexString;
401          }
402      }
403  
404      /**
405       * Class DARK_TEAL
406       *
407       */
408  
409      public final static class DARK_TEAL
410          extends HSSFColor
411      {
412          public final static short   index     = 0x38;
413          public final static short[] triplet   =
414          {
415              0, 51, 102
416          };
417          public final static String  hexString = "0:3333:6666";
418  
419          public short getIndex()
420          {
421              return index;
422          }
423  
424          public short [] getTriplet()
425          {
426              return triplet;
427          }
428  
429          public String getHexString()
430          {
431              return hexString;
432          }
433      }
434  
435      /**
436       * Class DARK_BLUE
437       *
438       */
439  
440      public final static class DARK_BLUE
441          extends HSSFColor
442      {
443          public final static short   index     = 0x12;
444          public final static short   index2    = 0x20;
445          public final static short[] triplet   =
446          {
447              0, 0, 128
448          };
449          public final static String  hexString = "0:0:8080";
450  
451          public short getIndex()
452          {
453              return index;
454          }
455  
456          public short [] getTriplet()
457          {
458              return triplet;
459          }
460  
461          public String getHexString()
462          {
463              return hexString;
464          }
465      }
466  
467      /**
468       * Class INDIGO
469       *
470       */
471  
472      public final static class INDIGO
473          extends HSSFColor
474      {
475          public final static short   index     = 0x3e;
476          public final static short[] triplet   =
477          {
478              51, 51, 153
479          };
480          public final static String  hexString = "3333:3333:9999";
481  
482          public short getIndex()
483          {
484              return index;
485          }
486  
487          public short [] getTriplet()
488          {
489              return triplet;
490          }
491  
492          public String getHexString()
493          {
494              return hexString;
495          }
496      }
497  
498      /**
499       * Class GREY_80_PERCENT
500       *
501       */
502  
503      public final static class GREY_80_PERCENT
504          extends HSSFColor
505      {
506          public final static short   index     = 0x3f;
507          public final static short[] triplet   =
508          {
509              51, 51, 51
510          };
511          public final static String  hexString = "3333:3333:3333";
512  
513          public short getIndex()
514          {
515              return index;
516          }
517  
518          public short [] getTriplet()
519          {
520              return triplet;
521          }
522  
523          public String getHexString()
524          {
525              return hexString;
526          }
527      }
528  
529      /**
530       * Class DARK_RED
531       *
532       */
533  
534      public final static class DARK_RED
535          extends HSSFColor
536      {
537          public final static short   index     = 0x10;
538          public final static short   index2    = 0x25;
539          public final static short[] triplet   =
540          {
541              128, 0, 0
542          };
543          public final static String  hexString = "8080:0:0";
544  
545          public short getIndex()
546          {
547              return index;
548          }
549  
550          public short [] getTriplet()
551          {
552              return triplet;
553          }
554  
555          public String getHexString()
556          {
557              return hexString;
558          }
559      }
560  
561      /**
562       * Class ORANGE
563       *
564       */
565  
566      public final static class ORANGE
567          extends HSSFColor
568      {
569          public final static short   index     = 0x35;
570          public final static short[] triplet   =
571          {
572              255, 102, 0
573          };
574          public final static String  hexString = "FFFF:6666:0";
575  
576          public short getIndex()
577          {
578              return index;
579          }
580  
581          public short [] getTriplet()
582          {
583              return triplet;
584          }
585  
586          public String getHexString()
587          {
588              return hexString;
589          }
590      }
591  
592      /**
593       * Class DARK_YELLOW
594       *
595       */
596  
597      public final static class DARK_YELLOW
598          extends HSSFColor
599      {
600          public final static short   index     = 0x13;
601          public final static short[] triplet   =
602          {
603              128, 128, 0
604          };
605          public final static String  hexString = "8080:8080:0";
606  
607          public short getIndex()
608          {
609              return index;
610          }
611  
612          public short [] getTriplet()
613          {
614              return triplet;
615          }
616  
617          public String getHexString()
618          {
619              return hexString;
620          }
621      }
622  
623      /**
624       * Class GREEN
625       *
626       */
627  
628      public final static class GREEN
629          extends HSSFColor
630      {
631          public final static short   index     = 0x11;
632          public final static short[] triplet   =
633          {
634              0, 128, 0
635          };
636          public final static String  hexString = "0:8080:0";
637  
638          public short getIndex()
639          {
640              return index;
641          }
642  
643          public short [] getTriplet()
644          {
645              return triplet;
646          }
647  
648          public String getHexString()
649          {
650              return hexString;
651          }
652      }
653  
654      /**
655       * Class TEAL
656       *
657       */
658  
659      public final static class TEAL
660          extends HSSFColor
661      {
662          public final static short   index     = 0x15;
663          public final static short   index2    = 0x26;
664          public final static short[] triplet   =
665          {
666              0, 128, 128
667          };
668          public final static String  hexString = "0:8080:8080";
669  
670          public short getIndex()
671          {
672              return index;
673          }
674  
675          public short [] getTriplet()
676          {
677              return triplet;
678          }
679  
680          public String getHexString()
681          {
682              return hexString;
683          }
684      }
685  
686      /**
687       * Class BLUE
688       *
689       */
690  
691      public final static class BLUE
692          extends HSSFColor
693      {
694          public final static short   index     = 0xc;
695          public final static short   index2    = 0x27;
696          public final static short[] triplet   =
697          {
698              0, 0, 255
699          };
700          public final static String  hexString = "0:0:FFFF";
701  
702          public short getIndex()
703          {
704              return index;
705          }
706  
707          public short [] getTriplet()
708          {
709              return triplet;
710          }
711  
712          public String getHexString()
713          {
714              return hexString;
715          }
716      }
717  
718      /**
719       * Class BLUE_GREY
720       *
721       */
722  
723      public final static class BLUE_GREY
724          extends HSSFColor
725      {
726          public final static short   index     = 0x36;
727          public final static short[] triplet   =
728          {
729              102, 102, 153
730          };
731          public final static String  hexString = "6666:6666:9999";
732  
733          public short getIndex()
734          {
735              return index;
736          }
737  
738          public short [] getTriplet()
739          {
740              return triplet;
741          }
742  
743          public String getHexString()
744          {
745              return hexString;
746          }
747      }
748  
749      /**
750       * Class GREY_50_PERCENT
751       *
752       */
753  
754      public final static class GREY_50_PERCENT
755          extends HSSFColor
756      {
757          public final static short   index     = 0x17;
758          public final static short[] triplet   =
759          {
760              128, 128, 128
761          };
762          public final static String  hexString = "8080:8080:8080";
763  
764          public short getIndex()
765          {
766              return index;
767          }
768  
769          public short [] getTriplet()
770          {
771              return triplet;
772          }
773  
774          public String getHexString()
775          {
776              return hexString;
777          }
778      }
779  
780      /**
781       * Class RED
782       *
783       */
784  
785      public final static class RED
786          extends HSSFColor
787      {
788          public final static short   index     = 0xa;
789          public final static short[] triplet   =
790          {
791              255, 0, 0
792          };
793          public final static String  hexString = "FFFF:0:0";
794  
795          public short getIndex()
796          {
797              return index;
798          }
799  
800          public short [] getTriplet()
801          {
802              return triplet;
803          }
804  
805          public String getHexString()
806          {
807              return hexString;
808          }
809      }
810  
811      /**
812       * Class LIGHT_ORANGE
813       *
814       */
815  
816      public final static class LIGHT_ORANGE
817          extends HSSFColor
818      {
819          public final static short   index     = 0x34;
820          public final static short[] triplet   =
821          {
822              255, 153, 0
823          };
824          public final static String  hexString = "FFFF:9999:0";
825  
826          public short getIndex()
827          {
828              return index;
829          }
830  
831          public short [] getTriplet()
832          {
833              return triplet;
834          }
835  
836          public String getHexString()
837          {
838              return hexString;
839          }
840      }
841  
842      /**
843       * Class LIME
844       *
845       */
846  
847      public final static class LIME
848          extends HSSFColor
849      {
850          public final static short   index     = 0x32;
851          public final static short[] triplet   =
852          {
853              153, 204, 0
854          };
855          public final static String  hexString = "9999:CCCC:0";
856  
857          public short getIndex()
858          {
859              return index;
860          }
861  
862          public short [] getTriplet()
863          {
864              return triplet;
865          }
866  
867          public String getHexString()
868          {
869              return hexString;
870          }
871      }
872  
873      /**
874       * Class SEA_GREEN
875       *
876       */
877  
878      public final static class SEA_GREEN
879          extends HSSFColor
880      {
881          public final static short   index     = 0x39;
882          public final static short[] triplet   =
883          {
884              51, 153, 102
885          };
886          public final static String  hexString = "3333:9999:6666";
887  
888          public short getIndex()
889          {
890              return index;
891          }
892  
893          public short [] getTriplet()
894          {
895              return triplet;
896          }
897  
898          public String getHexString()
899          {
900              return hexString;
901          }
902      }
903  
904      /**
905       * Class AQUA
906       *
907       */
908  
909      public final static class AQUA
910          extends HSSFColor
911      {
912          public final static short   index     = 0x31;
913          public final static short[] triplet   =
914          {
915              51, 204, 204
916          };
917          public final static String  hexString = "3333:CCCC:CCCC";
918  
919          public short getIndex()
920          {
921              return index;
922          }
923  
924          public short [] getTriplet()
925          {
926              return triplet;
927          }
928  
929          public String getHexString()
930          {
931              return hexString;
932          }
933      }
934  
935      /**
936       * Class LIGHT_BLUE
937       *
938       */
939  
940      public final static class LIGHT_BLUE
941          extends HSSFColor
942      {
943          public final static short   index     = 0x30;
944          public final static short[] triplet   =
945          {
946              51, 102, 255
947          };
948          public final static String  hexString = "3333:6666:FFFF";
949  
950          public short getIndex()
951          {
952              return index;
953          }
954  
955          public short [] getTriplet()
956          {
957              return triplet;
958          }
959  
960          public String getHexString()
961          {
962              return hexString;
963          }
964      }
965  
966      /**
967       * Class VIOLET
968       *
969       */
970  
971      public final static class VIOLET
972          extends HSSFColor
973      {
974          public final static short   index     = 0x14;
975          public final static short   index2    = 0x24;
976          public final static short[] triplet   =
977          {
978              128, 0, 128
979          };
980          public final static String  hexString = "8080:0:8080";
981  
982          public short getIndex()
983          {
984              return index;
985          }
986  
987          public short [] getTriplet()
988          {
989              return triplet;
990          }
991  
992          public String getHexString()
993          {
994              return hexString;
995          }
996      }
997  
998      /**
999       * Class GREY_40_PERCENT
1000      *
1001      */
1002 
1003     public final static class GREY_40_PERCENT
1004         extends HSSFColor
1005     {
1006         public final static short   index     = 0x37;
1007         public final static short[] triplet   =
1008         {
1009             150, 150, 150
1010         };
1011         public final static String  hexString = "9696:9696:9696";
1012 
1013         public short getIndex()
1014         {
1015             return index;
1016         }
1017 
1018         public short [] getTriplet()
1019         {
1020             return triplet;
1021         }
1022 
1023         public String getHexString()
1024         {
1025             return hexString;
1026         }
1027     }
1028 
1029     /**
1030      * Class PINK
1031      *
1032      */
1033 
1034     public final static class PINK
1035         extends HSSFColor
1036     {
1037         public final static short   index     = 0xe;
1038         public final static short   index2    = 0x21;
1039         public final static short[] triplet   =
1040         {
1041             255, 0, 255
1042         };
1043         public final static String  hexString = "FFFF:0:FFFF";
1044 
1045         public short getIndex()
1046         {
1047             return index;
1048         }
1049 
1050         public short [] getTriplet()
1051         {
1052             return triplet;
1053         }
1054 
1055         public String getHexString()
1056         {
1057             return hexString;
1058         }
1059     }
1060 
1061     /**
1062      * Class GOLD
1063      *
1064      */
1065 
1066     public final static class GOLD
1067         extends HSSFColor
1068     {
1069         public final static short   index     = 0x33;
1070         public final static short[] triplet   =
1071         {
1072             255, 204, 0
1073         };
1074         public final static String  hexString = "FFFF:CCCC:0";
1075 
1076         public short getIndex()
1077         {
1078             return index;
1079         }
1080 
1081         public short [] getTriplet()
1082         {
1083             return triplet;
1084         }
1085 
1086         public String getHexString()
1087         {
1088             return hexString;
1089         }
1090     }
1091 
1092     /**
1093      * Class YELLOW
1094      *
1095      */
1096 
1097     public final static class YELLOW
1098         extends HSSFColor
1099     {
1100         public final static short   index     = 0xd;
1101         public final static short   index2    = 0x22;
1102         public final static short[] triplet   =
1103         {
1104             255, 255, 0
1105         };
1106         public final static String  hexString = "FFFF:FFFF:0";
1107 
1108         public short getIndex()
1109         {
1110             return index;
1111         }
1112 
1113         public short [] getTriplet()
1114         {
1115             return triplet;
1116         }
1117 
1118         public String getHexString()
1119         {
1120             return hexString;
1121         }
1122     }
1123 
1124     /**
1125      * Class BRIGHT_GREEN
1126      *
1127      */
1128 
1129     public final static class BRIGHT_GREEN
1130         extends HSSFColor
1131     {
1132         public final static short   index     = 0xb;
1133         public final static short   index2    = 0x23;
1134         public final static short[] triplet   =
1135         {
1136             0, 255, 0
1137         };
1138         public final static String  hexString = "0:FFFF:0";
1139 
1140         public short getIndex()
1141         {
1142             return index;
1143         }
1144 
1145         public String getHexString()
1146         {
1147             return hexString;
1148         }
1149 
1150         public short [] getTriplet()
1151         {
1152             return triplet;
1153         }
1154     }
1155 
1156     /**
1157      * Class TURQUOISE
1158      *
1159      */
1160 
1161     public final static class TURQUOISE
1162         extends HSSFColor
1163     {
1164         public final static short   index     = 0xf;
1165         public final static short   index2    = 0x23;
1166         public final static short[] triplet   =
1167         {
1168             0, 255, 255
1169         };
1170         public final static String  hexString = "0:FFFF:FFFF";
1171 
1172         public short getIndex()
1173         {
1174             return index;
1175         }
1176 
1177         public short [] getTriplet()
1178         {
1179             return triplet;
1180         }
1181 
1182         public String getHexString()
1183         {
1184             return hexString;
1185         }
1186     }
1187 
1188     /**
1189      * Class SKY_BLUE
1190      *
1191      */
1192 
1193     public final static class SKY_BLUE
1194         extends HSSFColor
1195     {
1196         public final static short   index     = 0x28;
1197         public final static short[] triplet   =
1198         {
1199             0, 204, 255
1200         };
1201         public final static String  hexString = "0:CCCC:FFFF";
1202 
1203         public short getIndex()
1204         {
1205             return index;
1206         }
1207 
1208         public short [] getTriplet()
1209         {
1210             return triplet;
1211         }
1212 
1213         public String getHexString()
1214         {
1215             return hexString;
1216         }
1217     }
1218 
1219     /**
1220      * Class PLUM
1221      *
1222      */
1223 
1224     public final static class PLUM
1225         extends HSSFColor
1226     {
1227         public final static short   index     = 0x3d;
1228         public final static short   index2    = 0x19;
1229         public final static short[] triplet   =
1230         {
1231             153, 51, 102
1232         };
1233         public final static String  hexString = "9999:3333:6666";
1234 
1235         public short getIndex()
1236         {
1237             return index;
1238         }
1239 
1240         public short [] getTriplet()
1241         {
1242             return triplet;
1243         }
1244 
1245         public String getHexString()
1246         {
1247             return hexString;
1248         }
1249     }
1250 
1251     /**
1252      * Class GREY_25_PERCENT
1253      *
1254      */
1255 
1256     public final static class GREY_25_PERCENT
1257         extends HSSFColor
1258     {
1259         public final static short   index     = 0x16;
1260         public final static short[] triplet   =
1261         {
1262             192, 192, 192
1263         };
1264         public final static String  hexString = "C0C0:C0C0:C0C0";
1265 
1266         public short getIndex()
1267         {
1268             return index;
1269         }
1270 
1271         public short [] getTriplet()
1272         {
1273             return triplet;
1274         }
1275 
1276         public String getHexString()
1277         {
1278             return hexString;
1279         }
1280     }
1281 
1282     /**
1283      * Class ROSE
1284      *
1285      */
1286 
1287     public final static class ROSE
1288         extends HSSFColor
1289     {
1290         public final static short   index     = 0x2d;
1291         public final static short[] triplet   =
1292         {
1293             255, 153, 204
1294         };
1295         public final static String  hexString = "FFFF:9999:CCCC";
1296 
1297         public short getIndex()
1298         {
1299             return index;
1300         }
1301 
1302         public short [] getTriplet()
1303         {
1304             return triplet;
1305         }
1306 
1307         public String getHexString()
1308         {
1309             return hexString;
1310         }
1311     }
1312 
1313     /**
1314      * Class TAN
1315      *
1316      */
1317 
1318     public final static class TAN
1319         extends HSSFColor
1320     {
1321         public final static short   index     = 0x2f;
1322         public final static short[] triplet   =
1323         {
1324             255, 204, 153
1325         };
1326         public final static String  hexString = "FFFF:CCCC:9999";
1327 
1328         public short getIndex()
1329         {
1330             return index;
1331         }
1332 
1333         public short [] getTriplet()
1334         {
1335             return triplet;
1336         }
1337 
1338         public String getHexString()
1339         {
1340             return hexString;
1341         }
1342     }
1343 
1344     /**
1345      * Class LIGHT_YELLOW
1346      *
1347      */
1348 
1349     public final static class LIGHT_YELLOW
1350         extends HSSFColor
1351     {
1352         public final static short   index     = 0x2b;
1353         public final static short[] triplet   =
1354         {
1355             255, 255, 153
1356         };
1357         public final static String  hexString = "FFFF:FFFF:9999";
1358 
1359         public short getIndex()
1360         {
1361             return index;
1362         }
1363 
1364         public short [] getTriplet()
1365         {
1366             return triplet;
1367         }
1368 
1369         public String getHexString()
1370         {
1371             return hexString;
1372         }
1373     }
1374 
1375     /**
1376      * Class LIGHT_GREEN
1377      *
1378      */
1379 
1380     public final static class LIGHT_GREEN
1381         extends HSSFColor
1382     {
1383         public final static short   index     = 0x2a;
1384         public final static short[] triplet   =
1385         {
1386             204, 255, 204
1387         };
1388         public final static String  hexString = "CCCC:FFFF:CCCC";
1389 
1390         public short getIndex()
1391         {
1392             return index;
1393         }
1394 
1395         public short [] getTriplet()
1396         {
1397             return triplet;
1398         }
1399 
1400         public String getHexString()
1401         {
1402             return hexString;
1403         }
1404     }
1405 
1406     /**
1407      * Class LIGHT_TURQUOISE
1408      *
1409      */
1410 
1411     public final static class LIGHT_TURQUOISE
1412         extends HSSFColor
1413     {
1414         public final static short   index     = 0x29;
1415         public final static short   index2    = 0x1b;
1416         public final static short[] triplet   =
1417         {
1418             204, 255, 255
1419         };
1420         public final static String  hexString = "CCCC:FFFF:FFFF";
1421 
1422         public short getIndex()
1423         {
1424             return index;
1425         }
1426 
1427         public short [] getTriplet()
1428         {
1429             return triplet;
1430         }
1431 
1432         public String getHexString()
1433         {
1434             return hexString;
1435         }
1436     }
1437 
1438     /**
1439      * Class PALE_BLUE
1440      *
1441      */
1442 
1443     public final static class PALE_BLUE
1444         extends HSSFColor
1445     {
1446         public final static short   index     = 0x2c;
1447         public final static short[] triplet   =
1448         {
1449             153, 204, 255
1450         };
1451         public final static String  hexString = "9999:CCCC:FFFF";
1452 
1453         public short getIndex()
1454         {
1455             return index;
1456         }
1457 
1458         public short [] getTriplet()
1459         {
1460             return triplet;
1461         }
1462 
1463         public String getHexString()
1464         {
1465             return hexString;
1466         }
1467     }
1468 
1469     /**
1470      * Class LAVENDER
1471      *
1472      */
1473 
1474     public final static class LAVENDER
1475         extends HSSFColor
1476     {
1477         public final static short   index     = 0x2e;
1478         public final static short[] triplet   =
1479         {
1480             204, 153, 255
1481         };
1482         public final static String  hexString = "CCCC:9999:FFFF";
1483 
1484         public short getIndex()
1485         {
1486             return index;
1487         }
1488 
1489         public short [] getTriplet()
1490         {
1491             return triplet;
1492         }
1493 
1494         public String getHexString()
1495         {
1496             return hexString;
1497         }
1498     }
1499 
1500     /**
1501      * Class WHITE
1502      *
1503      */
1504 
1505     public final static class WHITE
1506         extends HSSFColor
1507     {
1508         public final static short   index     = 0x9;
1509         public final static short[] triplet   =
1510         {
1511             255, 255, 255
1512         };
1513         public final static String  hexString = "FFFF:FFFF:FFFF";
1514 
1515         public short getIndex()
1516         {
1517             return index;
1518         }
1519 
1520         public short [] getTriplet()
1521         {
1522             return triplet;
1523         }
1524 
1525         public String getHexString()
1526         {
1527             return hexString;
1528         }
1529     }
1530     
1531     /**
1532      * Class CORNFLOWER_BLUE
1533      */
1534     public final static class CORNFLOWER_BLUE
1535         extends HSSFColor
1536     {
1537         public final static short   index     = 0x18;
1538         public final static short[] triplet   =
1539         {
1540             153, 153, 255
1541         };
1542         public final static String  hexString = "9999:9999:FFFF";
1543 
1544         public short getIndex()
1545         {
1546             return index;
1547         }
1548 
1549         public short [] getTriplet()
1550         {
1551             return triplet;
1552         }
1553 
1554         public String getHexString()
1555         {
1556             return hexString;
1557         }
1558     }
1559     
1560     
1561     /**
1562      * Class LEMON_CHIFFON
1563      */
1564     public final static class LEMON_CHIFFON
1565         extends HSSFColor
1566     {
1567         public final static short   index     = 0x1a;
1568         public final static short[] triplet   =
1569         {
1570             255, 255, 204
1571         };
1572         public final static String  hexString = "FFFF:FFFF:CCCC";
1573 
1574         public short getIndex()
1575         {
1576             return index;
1577         }
1578 
1579         public short [] getTriplet()
1580         {
1581             return triplet;
1582         }
1583 
1584         public String getHexString()
1585         {
1586             return hexString;
1587         }
1588     }
1589     
1590     /**
1591      * Class MAROON
1592      */
1593     public final static class MAROON
1594         extends HSSFColor
1595     {
1596         public final static short   index     = 0x19;
1597         public final static short[] triplet   =
1598         {
1599             153, 51, 102
1600         };
1601         public final static String  hexString = "9999:3333:6666";
1602 
1603         public short getIndex()
1604         {
1605             return index;
1606         }
1607 
1608         public short [] getTriplet()
1609         {
1610             return triplet;
1611         }
1612 
1613         public String getHexString()
1614         {
1615             return hexString;
1616         }
1617     }
1618     
1619     /**
1620      * Class ORCHID
1621      */
1622     public final static class ORCHID
1623         extends HSSFColor
1624     {
1625         public final static short   index     = 0x1c;
1626         public final static short[] triplet   =
1627         {
1628             102, 0, 102
1629         };
1630         public final static String  hexString = "6666:0:6666";
1631 
1632         public short getIndex()
1633         {
1634             return index;
1635         }
1636 
1637         public short [] getTriplet()
1638         {
1639             return triplet;
1640         }
1641 
1642         public String getHexString()
1643         {
1644             return hexString;
1645         }
1646     }
1647     
1648     /**
1649      * Class CORAL
1650      */
1651     public final static class CORAL
1652         extends HSSFColor
1653     {
1654         public final static short   index     = 0x1d;
1655         public final static short[] triplet   =
1656         {
1657             255, 128, 128
1658         };
1659         public final static String  hexString = "FFFF:8080:8080";
1660 
1661         public short getIndex()
1662         {
1663             return index;
1664         }
1665 
1666         public short [] getTriplet()
1667         {
1668             return triplet;
1669         }
1670 
1671         public String getHexString()
1672         {
1673             return hexString;
1674         }
1675     }
1676     
1677     /**
1678      * Class ROYAL_BLUE
1679      */
1680     public final static class ROYAL_BLUE
1681         extends HSSFColor
1682     {
1683         public final static short   index     = 0x1e;
1684         public final static short[] triplet   =
1685         {
1686             0, 102, 204
1687         };
1688         public final static String  hexString = "0:6666:CCCC";
1689 
1690         public short getIndex()
1691         {
1692             return index;
1693         }
1694 
1695         public short [] getTriplet()
1696         {
1697             return triplet;
1698         }
1699 
1700         public String getHexString()
1701         {
1702             return hexString;
1703         }
1704     }
1705     
1706     /**
1707      * Class LIGHT_CORNFLOWER_BLUE
1708      */
1709     public final static class LIGHT_CORNFLOWER_BLUE
1710         extends HSSFColor
1711     {
1712         public final static short   index     = 0x1f;
1713         public final static short[] triplet   =
1714         {
1715             204, 204, 255
1716         };
1717         public final static String  hexString = "CCCC:CCCC:FFFF";
1718 
1719         public short getIndex()
1720         {
1721             return index;
1722         }
1723 
1724         public short [] getTriplet()
1725         {
1726             return triplet;
1727         }
1728 
1729         public String getHexString()
1730         {
1731             return hexString;
1732         }
1733     }
1734 }
1735