0001: /* ====================================================================
0002: Licensed to the Apache Software Foundation (ASF) under one or more
0003: contributor license agreements. See the NOTICE file distributed with
0004: this work for additional information regarding copyright ownership.
0005: The ASF licenses this file to You under the Apache License, Version 2.0
0006: (the "License"); you may not use this file except in compliance with
0007: the License. You may obtain a copy of the License at
0008:
0009: http://www.apache.org/licenses/LICENSE-2.0
0010:
0011: Unless required by applicable law or agreed to in writing, software
0012: distributed under the License is distributed on an "AS IS" BASIS,
0013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014: See the License for the specific language governing permissions and
0015: limitations under the License.
0016: ==================================================================== */
0017:
0018: package org.apache.poi.hssf.util;
0019:
0020: import java.util.*;
0021:
0022: /**
0023: * Intends to provide support for the very evil index to triplet issue and
0024: * will likely replace the color contants interface for HSSF 2.0.
0025: * This class contains static inner class members for representing colors.
0026: * Each color has an index (for the standard palette in Excel (tm) ),
0027: * native (RGB) triplet and string triplet. The string triplet is as the
0028: * color would be represented by Gnumeric. Having (string) this here is a bit of a
0029: * collusion of function between HSSF and the HSSFSerializer but I think its
0030: * a reasonable one in this case.
0031: *
0032: * @author Andrew C. Oliver (acoliver at apache dot org)
0033: * @author Brian Sanders (bsanders at risklabs dot com) - full default color palette
0034: */
0035:
0036: public class HSSFColor {
0037: private final static int PALETTE_SIZE = 56;
0038: private final static int DISTINCT_COLOR_COUNT = 46;
0039:
0040: /** Creates a new instance of HSSFColor */
0041:
0042: public HSSFColor() {
0043: }
0044:
0045: /**
0046: * this function returns all colors in a hastable. Its not implemented as a
0047: * static member/staticly initialized because that would be dirty in a
0048: * server environment as it is intended. This means you'll eat the time
0049: * it takes to create it once per request but you will not hold onto it
0050: * if you have none of those requests.
0051: *
0052: * @return a hashtable containing all colors mapped to their excel-style
0053: * pallette index
0054: */
0055: public final static Hashtable getIndexHash() {
0056:
0057: Hashtable hash = new Hashtable(PALETTE_SIZE);
0058:
0059: hash.put(new Integer(HSSFColor.BLACK.index),
0060: new HSSFColor.BLACK());
0061: hash.put(new Integer(HSSFColor.BROWN.index),
0062: new HSSFColor.BROWN());
0063: hash.put(new Integer(HSSFColor.OLIVE_GREEN.index),
0064: new HSSFColor.OLIVE_GREEN());
0065: hash.put(new Integer(HSSFColor.DARK_GREEN.index),
0066: new HSSFColor.DARK_GREEN());
0067: hash.put(new Integer(HSSFColor.DARK_TEAL.index),
0068: new HSSFColor.DARK_TEAL());
0069: hash.put(new Integer(HSSFColor.DARK_BLUE.index),
0070: new HSSFColor.DARK_BLUE());
0071: hash.put(new Integer(HSSFColor.DARK_BLUE.index2),
0072: new HSSFColor.DARK_BLUE());
0073: hash.put(new Integer(HSSFColor.INDIGO.index),
0074: new HSSFColor.INDIGO());
0075: hash.put(new Integer(HSSFColor.GREY_80_PERCENT.index),
0076: new HSSFColor.GREY_80_PERCENT());
0077: hash.put(new Integer(HSSFColor.ORANGE.index),
0078: new HSSFColor.ORANGE());
0079: hash.put(new Integer(HSSFColor.DARK_YELLOW.index),
0080: new HSSFColor.DARK_YELLOW());
0081: hash.put(new Integer(HSSFColor.GREEN.index),
0082: new HSSFColor.GREEN());
0083: hash.put(new Integer(HSSFColor.TEAL.index),
0084: new HSSFColor.TEAL());
0085: hash.put(new Integer(HSSFColor.TEAL.index2),
0086: new HSSFColor.TEAL());
0087: hash.put(new Integer(HSSFColor.BLUE.index),
0088: new HSSFColor.BLUE());
0089: hash.put(new Integer(HSSFColor.BLUE.index2),
0090: new HSSFColor.BLUE());
0091: hash.put(new Integer(HSSFColor.BLUE_GREY.index),
0092: new HSSFColor.BLUE_GREY());
0093: hash.put(new Integer(HSSFColor.GREY_50_PERCENT.index),
0094: new HSSFColor.GREY_50_PERCENT());
0095: hash.put(new Integer(HSSFColor.RED.index), new HSSFColor.RED());
0096: hash.put(new Integer(HSSFColor.LIGHT_ORANGE.index),
0097: new HSSFColor.LIGHT_ORANGE());
0098: hash.put(new Integer(HSSFColor.LIME.index),
0099: new HSSFColor.LIME());
0100: hash.put(new Integer(HSSFColor.SEA_GREEN.index),
0101: new HSSFColor.SEA_GREEN());
0102: hash.put(new Integer(HSSFColor.AQUA.index),
0103: new HSSFColor.AQUA());
0104: hash.put(new Integer(HSSFColor.LIGHT_BLUE.index),
0105: new HSSFColor.LIGHT_BLUE());
0106: hash.put(new Integer(HSSFColor.VIOLET.index),
0107: new HSSFColor.VIOLET());
0108: hash.put(new Integer(HSSFColor.VIOLET.index2),
0109: new HSSFColor.VIOLET());
0110: hash.put(new Integer(HSSFColor.GREY_40_PERCENT.index),
0111: new HSSFColor.GREY_40_PERCENT());
0112: hash.put(new Integer(HSSFColor.PINK.index),
0113: new HSSFColor.PINK());
0114: hash.put(new Integer(HSSFColor.PINK.index2),
0115: new HSSFColor.PINK());
0116: hash.put(new Integer(HSSFColor.GOLD.index),
0117: new HSSFColor.GOLD());
0118: hash.put(new Integer(HSSFColor.YELLOW.index),
0119: new HSSFColor.YELLOW());
0120: hash.put(new Integer(HSSFColor.YELLOW.index2),
0121: new HSSFColor.YELLOW());
0122: hash.put(new Integer(HSSFColor.BRIGHT_GREEN.index),
0123: new HSSFColor.BRIGHT_GREEN());
0124: hash.put(new Integer(HSSFColor.BRIGHT_GREEN.index2),
0125: new HSSFColor.BRIGHT_GREEN());
0126: hash.put(new Integer(HSSFColor.TURQUOISE.index),
0127: new HSSFColor.TURQUOISE());
0128: hash.put(new Integer(HSSFColor.TURQUOISE.index2),
0129: new HSSFColor.TURQUOISE());
0130: hash.put(new Integer(HSSFColor.DARK_RED.index),
0131: new HSSFColor.DARK_RED());
0132: hash.put(new Integer(HSSFColor.DARK_RED.index2),
0133: new HSSFColor.DARK_RED());
0134: hash.put(new Integer(HSSFColor.SKY_BLUE.index),
0135: new HSSFColor.SKY_BLUE());
0136: hash.put(new Integer(HSSFColor.PLUM.index),
0137: new HSSFColor.PLUM());
0138: hash.put(new Integer(HSSFColor.PLUM.index2),
0139: new HSSFColor.PLUM());
0140: hash.put(new Integer(HSSFColor.GREY_25_PERCENT.index),
0141: new HSSFColor.GREY_25_PERCENT());
0142: hash.put(new Integer(HSSFColor.ROSE.index),
0143: new HSSFColor.ROSE());
0144: hash.put(new Integer(HSSFColor.LIGHT_YELLOW.index),
0145: new HSSFColor.LIGHT_YELLOW());
0146: hash.put(new Integer(HSSFColor.LIGHT_GREEN.index),
0147: new HSSFColor.LIGHT_GREEN());
0148: hash.put(new Integer(HSSFColor.LIGHT_TURQUOISE.index),
0149: new HSSFColor.LIGHT_TURQUOISE());
0150: hash.put(new Integer(HSSFColor.LIGHT_TURQUOISE.index2),
0151: new HSSFColor.LIGHT_TURQUOISE());
0152: hash.put(new Integer(HSSFColor.PALE_BLUE.index),
0153: new HSSFColor.PALE_BLUE());
0154: hash.put(new Integer(HSSFColor.LAVENDER.index),
0155: new HSSFColor.LAVENDER());
0156: hash.put(new Integer(HSSFColor.WHITE.index),
0157: new HSSFColor.WHITE());
0158: hash.put(new Integer(HSSFColor.CORNFLOWER_BLUE.index),
0159: new HSSFColor.CORNFLOWER_BLUE());
0160: hash.put(new Integer(HSSFColor.LEMON_CHIFFON.index),
0161: new HSSFColor.LEMON_CHIFFON());
0162: hash.put(new Integer(HSSFColor.MAROON.index),
0163: new HSSFColor.MAROON());
0164: hash.put(new Integer(HSSFColor.ORCHID.index),
0165: new HSSFColor.ORCHID());
0166: hash.put(new Integer(HSSFColor.CORAL.index),
0167: new HSSFColor.CORAL());
0168: hash.put(new Integer(HSSFColor.ROYAL_BLUE.index),
0169: new HSSFColor.ROYAL_BLUE());
0170: hash.put(new Integer(HSSFColor.LIGHT_CORNFLOWER_BLUE.index),
0171: new HSSFColor.LIGHT_CORNFLOWER_BLUE());
0172: return hash;
0173: }
0174:
0175: /**
0176: * this function returns all colors in a hastable. Its not implemented as a
0177: * static member/staticly initialized because that would be dirty in a
0178: * server environment as it is intended. This means you'll eat the time
0179: * it takes to create it once per request but you will not hold onto it
0180: * if you have none of those requests.
0181: *
0182: * @return a hashtable containing all colors mapped to their gnumeric-like
0183: * triplet string
0184: */
0185:
0186: public final static Hashtable getTripletHash() {
0187: Hashtable hash = new Hashtable(DISTINCT_COLOR_COUNT);
0188:
0189: hash.put(HSSFColor.BLACK.hexString, new HSSFColor.BLACK());
0190: hash.put(HSSFColor.BROWN.hexString, new HSSFColor.BROWN());
0191: hash.put(HSSFColor.OLIVE_GREEN.hexString,
0192: new HSSFColor.OLIVE_GREEN());
0193: hash.put(HSSFColor.DARK_GREEN.hexString,
0194: new HSSFColor.DARK_GREEN());
0195: hash.put(HSSFColor.DARK_TEAL.hexString,
0196: new HSSFColor.DARK_TEAL());
0197: hash.put(HSSFColor.DARK_BLUE.hexString,
0198: new HSSFColor.DARK_BLUE());
0199: hash.put(HSSFColor.INDIGO.hexString, new HSSFColor.INDIGO());
0200: hash.put(HSSFColor.GREY_80_PERCENT.hexString,
0201: new HSSFColor.GREY_80_PERCENT());
0202: hash.put(HSSFColor.ORANGE.hexString, new HSSFColor.ORANGE());
0203: hash.put(HSSFColor.DARK_YELLOW.hexString,
0204: new HSSFColor.DARK_YELLOW());
0205: hash.put(HSSFColor.GREEN.hexString, new HSSFColor.GREEN());
0206: hash.put(HSSFColor.TEAL.hexString, new HSSFColor.TEAL());
0207: hash.put(HSSFColor.BLUE.hexString, new HSSFColor.BLUE());
0208: hash.put(HSSFColor.BLUE_GREY.hexString,
0209: new HSSFColor.BLUE_GREY());
0210: hash.put(HSSFColor.GREY_50_PERCENT.hexString,
0211: new HSSFColor.GREY_50_PERCENT());
0212: hash.put(HSSFColor.RED.hexString, new HSSFColor.RED());
0213: hash.put(HSSFColor.LIGHT_ORANGE.hexString,
0214: new HSSFColor.LIGHT_ORANGE());
0215: hash.put(HSSFColor.LIME.hexString, new HSSFColor.LIME());
0216: hash.put(HSSFColor.SEA_GREEN.hexString,
0217: new HSSFColor.SEA_GREEN());
0218: hash.put(HSSFColor.AQUA.hexString, new HSSFColor.AQUA());
0219: hash.put(HSSFColor.LIGHT_BLUE.hexString,
0220: new HSSFColor.LIGHT_BLUE());
0221: hash.put(HSSFColor.VIOLET.hexString, new HSSFColor.VIOLET());
0222: hash.put(HSSFColor.GREY_40_PERCENT.hexString,
0223: new HSSFColor.GREY_40_PERCENT());
0224: hash.put(HSSFColor.PINK.hexString, new HSSFColor.PINK());
0225: hash.put(HSSFColor.GOLD.hexString, new HSSFColor.GOLD());
0226: hash.put(HSSFColor.YELLOW.hexString, new HSSFColor.YELLOW());
0227: hash.put(HSSFColor.BRIGHT_GREEN.hexString,
0228: new HSSFColor.BRIGHT_GREEN());
0229: hash.put(HSSFColor.TURQUOISE.hexString,
0230: new HSSFColor.TURQUOISE());
0231: hash
0232: .put(HSSFColor.DARK_RED.hexString,
0233: new HSSFColor.DARK_RED());
0234: hash
0235: .put(HSSFColor.SKY_BLUE.hexString,
0236: new HSSFColor.SKY_BLUE());
0237: hash.put(HSSFColor.PLUM.hexString, new HSSFColor.PLUM());
0238: hash.put(HSSFColor.GREY_25_PERCENT.hexString,
0239: new HSSFColor.GREY_25_PERCENT());
0240: hash.put(HSSFColor.ROSE.hexString, new HSSFColor.ROSE());
0241: hash.put(HSSFColor.LIGHT_YELLOW.hexString,
0242: new HSSFColor.LIGHT_YELLOW());
0243: hash.put(HSSFColor.LIGHT_GREEN.hexString,
0244: new HSSFColor.LIGHT_GREEN());
0245: hash.put(HSSFColor.LIGHT_TURQUOISE.hexString,
0246: new HSSFColor.LIGHT_TURQUOISE());
0247: hash.put(HSSFColor.PALE_BLUE.hexString,
0248: new HSSFColor.PALE_BLUE());
0249: hash
0250: .put(HSSFColor.LAVENDER.hexString,
0251: new HSSFColor.LAVENDER());
0252: hash.put(HSSFColor.WHITE.hexString, new HSSFColor.WHITE());
0253: hash.put(HSSFColor.CORNFLOWER_BLUE.hexString,
0254: new HSSFColor.CORNFLOWER_BLUE());
0255: hash.put(HSSFColor.LEMON_CHIFFON.hexString,
0256: new HSSFColor.LEMON_CHIFFON());
0257: hash.put(HSSFColor.MAROON.hexString, new HSSFColor.MAROON());
0258: hash.put(HSSFColor.ORCHID.hexString, new HSSFColor.ORCHID());
0259: hash.put(HSSFColor.CORAL.hexString, new HSSFColor.CORAL());
0260: hash.put(HSSFColor.ROYAL_BLUE.hexString,
0261: new HSSFColor.ROYAL_BLUE());
0262: hash.put(HSSFColor.LIGHT_CORNFLOWER_BLUE.hexString,
0263: new HSSFColor.LIGHT_CORNFLOWER_BLUE());
0264: return hash;
0265: }
0266:
0267: /**
0268: * @return index to the standard palette
0269: */
0270:
0271: public short getIndex() {
0272: return BLACK.index;
0273: }
0274:
0275: /**
0276: * @return triplet representation like that in Excel
0277: */
0278:
0279: public short[] getTriplet() {
0280: return BLACK.triplet;
0281: }
0282:
0283: // its a hack but its a good hack
0284:
0285: /**
0286: * @return a hex string exactly like a gnumeric triplet
0287: */
0288:
0289: public String getHexString() {
0290: return BLACK.hexString;
0291: }
0292:
0293: /**
0294: * Class BLACK
0295: *
0296: */
0297:
0298: public final static class BLACK extends HSSFColor {
0299: public final static short index = 0x8;
0300: public final static short[] triplet = { 0, 0, 0 };
0301: public final static String hexString = "0:0:0";
0302:
0303: public short getIndex() {
0304: return index;
0305: }
0306:
0307: public short[] getTriplet() {
0308: return triplet;
0309: }
0310:
0311: public String getHexString() {
0312: return hexString;
0313: }
0314: }
0315:
0316: /**
0317: * Class BROWN
0318: *
0319: */
0320:
0321: public final static class BROWN extends HSSFColor {
0322: public final static short index = 0x3c;
0323: public final static short[] triplet = { 153, 51, 0 };
0324: public final static String hexString = "9999:3333:0";
0325:
0326: public short getIndex() {
0327: return index;
0328: }
0329:
0330: public short[] getTriplet() {
0331: return triplet;
0332: }
0333:
0334: public String getHexString() {
0335: return hexString;
0336: }
0337: }
0338:
0339: /**
0340: * Class OLIVE_GREEN
0341: *
0342: */
0343:
0344: public static class OLIVE_GREEN extends HSSFColor {
0345: public final static short index = 0x3b;
0346: public final static short[] triplet = { 51, 51, 0 };
0347: public final static String hexString = "3333:3333:0";
0348:
0349: public short getIndex() {
0350: return index;
0351: }
0352:
0353: public short[] getTriplet() {
0354: return triplet;
0355: }
0356:
0357: public String getHexString() {
0358: return hexString;
0359: }
0360: }
0361:
0362: /**
0363: * Class DARK_GREEN
0364: *
0365: */
0366:
0367: public final static class DARK_GREEN extends HSSFColor {
0368: public final static short index = 0x3a;
0369: public final static short[] triplet = { 0, 51, 0 };
0370: public final static String hexString = "0:3333:0";
0371:
0372: public short getIndex() {
0373: return index;
0374: }
0375:
0376: public short[] getTriplet() {
0377: return triplet;
0378: }
0379:
0380: public String getHexString() {
0381: return hexString;
0382: }
0383: }
0384:
0385: /**
0386: * Class DARK_TEAL
0387: *
0388: */
0389:
0390: public final static class DARK_TEAL extends HSSFColor {
0391: public final static short index = 0x38;
0392: public final static short[] triplet = { 0, 51, 102 };
0393: public final static String hexString = "0:3333:6666";
0394:
0395: public short getIndex() {
0396: return index;
0397: }
0398:
0399: public short[] getTriplet() {
0400: return triplet;
0401: }
0402:
0403: public String getHexString() {
0404: return hexString;
0405: }
0406: }
0407:
0408: /**
0409: * Class DARK_BLUE
0410: *
0411: */
0412:
0413: public final static class DARK_BLUE extends HSSFColor {
0414: public final static short index = 0x12;
0415: public final static short index2 = 0x20;
0416: public final static short[] triplet = { 0, 0, 128 };
0417: public final static String hexString = "0:0:8080";
0418:
0419: public short getIndex() {
0420: return index;
0421: }
0422:
0423: public short[] getTriplet() {
0424: return triplet;
0425: }
0426:
0427: public String getHexString() {
0428: return hexString;
0429: }
0430: }
0431:
0432: /**
0433: * Class INDIGO
0434: *
0435: */
0436:
0437: public final static class INDIGO extends HSSFColor {
0438: public final static short index = 0x3e;
0439: public final static short[] triplet = { 51, 51, 153 };
0440: public final static String hexString = "3333:3333:9999";
0441:
0442: public short getIndex() {
0443: return index;
0444: }
0445:
0446: public short[] getTriplet() {
0447: return triplet;
0448: }
0449:
0450: public String getHexString() {
0451: return hexString;
0452: }
0453: }
0454:
0455: /**
0456: * Class GREY_80_PERCENT
0457: *
0458: */
0459:
0460: public final static class GREY_80_PERCENT extends HSSFColor {
0461: public final static short index = 0x3f;
0462: public final static short[] triplet = { 51, 51, 51 };
0463: public final static String hexString = "3333:3333:3333";
0464:
0465: public short getIndex() {
0466: return index;
0467: }
0468:
0469: public short[] getTriplet() {
0470: return triplet;
0471: }
0472:
0473: public String getHexString() {
0474: return hexString;
0475: }
0476: }
0477:
0478: /**
0479: * Class DARK_RED
0480: *
0481: */
0482:
0483: public final static class DARK_RED extends HSSFColor {
0484: public final static short index = 0x10;
0485: public final static short index2 = 0x25;
0486: public final static short[] triplet = { 128, 0, 0 };
0487: public final static String hexString = "8080:0:0";
0488:
0489: public short getIndex() {
0490: return index;
0491: }
0492:
0493: public short[] getTriplet() {
0494: return triplet;
0495: }
0496:
0497: public String getHexString() {
0498: return hexString;
0499: }
0500: }
0501:
0502: /**
0503: * Class ORANGE
0504: *
0505: */
0506:
0507: public final static class ORANGE extends HSSFColor {
0508: public final static short index = 0x35;
0509: public final static short[] triplet = { 255, 102, 0 };
0510: public final static String hexString = "FFFF:6666:0";
0511:
0512: public short getIndex() {
0513: return index;
0514: }
0515:
0516: public short[] getTriplet() {
0517: return triplet;
0518: }
0519:
0520: public String getHexString() {
0521: return hexString;
0522: }
0523: }
0524:
0525: /**
0526: * Class DARK_YELLOW
0527: *
0528: */
0529:
0530: public final static class DARK_YELLOW extends HSSFColor {
0531: public final static short index = 0x13;
0532: public final static short[] triplet = { 128, 128, 0 };
0533: public final static String hexString = "8080:8080:0";
0534:
0535: public short getIndex() {
0536: return index;
0537: }
0538:
0539: public short[] getTriplet() {
0540: return triplet;
0541: }
0542:
0543: public String getHexString() {
0544: return hexString;
0545: }
0546: }
0547:
0548: /**
0549: * Class GREEN
0550: *
0551: */
0552:
0553: public final static class GREEN extends HSSFColor {
0554: public final static short index = 0x11;
0555: public final static short[] triplet = { 0, 128, 0 };
0556: public final static String hexString = "0:8080:0";
0557:
0558: public short getIndex() {
0559: return index;
0560: }
0561:
0562: public short[] getTriplet() {
0563: return triplet;
0564: }
0565:
0566: public String getHexString() {
0567: return hexString;
0568: }
0569: }
0570:
0571: /**
0572: * Class TEAL
0573: *
0574: */
0575:
0576: public final static class TEAL extends HSSFColor {
0577: public final static short index = 0x15;
0578: public final static short index2 = 0x26;
0579: public final static short[] triplet = { 0, 128, 128 };
0580: public final static String hexString = "0:8080:8080";
0581:
0582: public short getIndex() {
0583: return index;
0584: }
0585:
0586: public short[] getTriplet() {
0587: return triplet;
0588: }
0589:
0590: public String getHexString() {
0591: return hexString;
0592: }
0593: }
0594:
0595: /**
0596: * Class BLUE
0597: *
0598: */
0599:
0600: public final static class BLUE extends HSSFColor {
0601: public final static short index = 0xc;
0602: public final static short index2 = 0x27;
0603: public final static short[] triplet = { 0, 0, 255 };
0604: public final static String hexString = "0:0:FFFF";
0605:
0606: public short getIndex() {
0607: return index;
0608: }
0609:
0610: public short[] getTriplet() {
0611: return triplet;
0612: }
0613:
0614: public String getHexString() {
0615: return hexString;
0616: }
0617: }
0618:
0619: /**
0620: * Class BLUE_GREY
0621: *
0622: */
0623:
0624: public final static class BLUE_GREY extends HSSFColor {
0625: public final static short index = 0x36;
0626: public final static short[] triplet = { 102, 102, 153 };
0627: public final static String hexString = "6666:6666:9999";
0628:
0629: public short getIndex() {
0630: return index;
0631: }
0632:
0633: public short[] getTriplet() {
0634: return triplet;
0635: }
0636:
0637: public String getHexString() {
0638: return hexString;
0639: }
0640: }
0641:
0642: /**
0643: * Class GREY_50_PERCENT
0644: *
0645: */
0646:
0647: public final static class GREY_50_PERCENT extends HSSFColor {
0648: public final static short index = 0x17;
0649: public final static short[] triplet = { 128, 128, 128 };
0650: public final static String hexString = "8080:8080:8080";
0651:
0652: public short getIndex() {
0653: return index;
0654: }
0655:
0656: public short[] getTriplet() {
0657: return triplet;
0658: }
0659:
0660: public String getHexString() {
0661: return hexString;
0662: }
0663: }
0664:
0665: /**
0666: * Class RED
0667: *
0668: */
0669:
0670: public final static class RED extends HSSFColor {
0671: public final static short index = 0xa;
0672: public final static short[] triplet = { 255, 0, 0 };
0673: public final static String hexString = "FFFF:0:0";
0674:
0675: public short getIndex() {
0676: return index;
0677: }
0678:
0679: public short[] getTriplet() {
0680: return triplet;
0681: }
0682:
0683: public String getHexString() {
0684: return hexString;
0685: }
0686: }
0687:
0688: /**
0689: * Class LIGHT_ORANGE
0690: *
0691: */
0692:
0693: public final static class LIGHT_ORANGE extends HSSFColor {
0694: public final static short index = 0x34;
0695: public final static short[] triplet = { 255, 153, 0 };
0696: public final static String hexString = "FFFF:9999:0";
0697:
0698: public short getIndex() {
0699: return index;
0700: }
0701:
0702: public short[] getTriplet() {
0703: return triplet;
0704: }
0705:
0706: public String getHexString() {
0707: return hexString;
0708: }
0709: }
0710:
0711: /**
0712: * Class LIME
0713: *
0714: */
0715:
0716: public final static class LIME extends HSSFColor {
0717: public final static short index = 0x32;
0718: public final static short[] triplet = { 153, 204, 0 };
0719: public final static String hexString = "9999:CCCC:0";
0720:
0721: public short getIndex() {
0722: return index;
0723: }
0724:
0725: public short[] getTriplet() {
0726: return triplet;
0727: }
0728:
0729: public String getHexString() {
0730: return hexString;
0731: }
0732: }
0733:
0734: /**
0735: * Class SEA_GREEN
0736: *
0737: */
0738:
0739: public final static class SEA_GREEN extends HSSFColor {
0740: public final static short index = 0x39;
0741: public final static short[] triplet = { 51, 153, 102 };
0742: public final static String hexString = "3333:9999:6666";
0743:
0744: public short getIndex() {
0745: return index;
0746: }
0747:
0748: public short[] getTriplet() {
0749: return triplet;
0750: }
0751:
0752: public String getHexString() {
0753: return hexString;
0754: }
0755: }
0756:
0757: /**
0758: * Class AQUA
0759: *
0760: */
0761:
0762: public final static class AQUA extends HSSFColor {
0763: public final static short index = 0x31;
0764: public final static short[] triplet = { 51, 204, 204 };
0765: public final static String hexString = "3333:CCCC:CCCC";
0766:
0767: public short getIndex() {
0768: return index;
0769: }
0770:
0771: public short[] getTriplet() {
0772: return triplet;
0773: }
0774:
0775: public String getHexString() {
0776: return hexString;
0777: }
0778: }
0779:
0780: /**
0781: * Class LIGHT_BLUE
0782: *
0783: */
0784:
0785: public final static class LIGHT_BLUE extends HSSFColor {
0786: public final static short index = 0x30;
0787: public final static short[] triplet = { 51, 102, 255 };
0788: public final static String hexString = "3333:6666:FFFF";
0789:
0790: public short getIndex() {
0791: return index;
0792: }
0793:
0794: public short[] getTriplet() {
0795: return triplet;
0796: }
0797:
0798: public String getHexString() {
0799: return hexString;
0800: }
0801: }
0802:
0803: /**
0804: * Class VIOLET
0805: *
0806: */
0807:
0808: public final static class VIOLET extends HSSFColor {
0809: public final static short index = 0x14;
0810: public final static short index2 = 0x24;
0811: public final static short[] triplet = { 128, 0, 128 };
0812: public final static String hexString = "8080:0:8080";
0813:
0814: public short getIndex() {
0815: return index;
0816: }
0817:
0818: public short[] getTriplet() {
0819: return triplet;
0820: }
0821:
0822: public String getHexString() {
0823: return hexString;
0824: }
0825: }
0826:
0827: /**
0828: * Class GREY_40_PERCENT
0829: *
0830: */
0831:
0832: public final static class GREY_40_PERCENT extends HSSFColor {
0833: public final static short index = 0x37;
0834: public final static short[] triplet = { 150, 150, 150 };
0835: public final static String hexString = "9696:9696:9696";
0836:
0837: public short getIndex() {
0838: return index;
0839: }
0840:
0841: public short[] getTriplet() {
0842: return triplet;
0843: }
0844:
0845: public String getHexString() {
0846: return hexString;
0847: }
0848: }
0849:
0850: /**
0851: * Class PINK
0852: *
0853: */
0854:
0855: public final static class PINK extends HSSFColor {
0856: public final static short index = 0xe;
0857: public final static short index2 = 0x21;
0858: public final static short[] triplet = { 255, 0, 255 };
0859: public final static String hexString = "FFFF:0:FFFF";
0860:
0861: public short getIndex() {
0862: return index;
0863: }
0864:
0865: public short[] getTriplet() {
0866: return triplet;
0867: }
0868:
0869: public String getHexString() {
0870: return hexString;
0871: }
0872: }
0873:
0874: /**
0875: * Class GOLD
0876: *
0877: */
0878:
0879: public final static class GOLD extends HSSFColor {
0880: public final static short index = 0x33;
0881: public final static short[] triplet = { 255, 204, 0 };
0882: public final static String hexString = "FFFF:CCCC:0";
0883:
0884: public short getIndex() {
0885: return index;
0886: }
0887:
0888: public short[] getTriplet() {
0889: return triplet;
0890: }
0891:
0892: public String getHexString() {
0893: return hexString;
0894: }
0895: }
0896:
0897: /**
0898: * Class YELLOW
0899: *
0900: */
0901:
0902: public final static class YELLOW extends HSSFColor {
0903: public final static short index = 0xd;
0904: public final static short index2 = 0x22;
0905: public final static short[] triplet = { 255, 255, 0 };
0906: public final static String hexString = "FFFF:FFFF:0";
0907:
0908: public short getIndex() {
0909: return index;
0910: }
0911:
0912: public short[] getTriplet() {
0913: return triplet;
0914: }
0915:
0916: public String getHexString() {
0917: return hexString;
0918: }
0919: }
0920:
0921: /**
0922: * Class BRIGHT_GREEN
0923: *
0924: */
0925:
0926: public final static class BRIGHT_GREEN extends HSSFColor {
0927: public final static short index = 0xb;
0928: public final static short index2 = 0x23;
0929: public final static short[] triplet = { 0, 255, 0 };
0930: public final static String hexString = "0:FFFF:0";
0931:
0932: public short getIndex() {
0933: return index;
0934: }
0935:
0936: public String getHexString() {
0937: return hexString;
0938: }
0939:
0940: public short[] getTriplet() {
0941: return triplet;
0942: }
0943: }
0944:
0945: /**
0946: * Class TURQUOISE
0947: *
0948: */
0949:
0950: public final static class TURQUOISE extends HSSFColor {
0951: public final static short index = 0xf;
0952: public final static short index2 = 0x23;
0953: public final static short[] triplet = { 0, 255, 255 };
0954: public final static String hexString = "0:FFFF:FFFF";
0955:
0956: public short getIndex() {
0957: return index;
0958: }
0959:
0960: public short[] getTriplet() {
0961: return triplet;
0962: }
0963:
0964: public String getHexString() {
0965: return hexString;
0966: }
0967: }
0968:
0969: /**
0970: * Class SKY_BLUE
0971: *
0972: */
0973:
0974: public final static class SKY_BLUE extends HSSFColor {
0975: public final static short index = 0x28;
0976: public final static short[] triplet = { 0, 204, 255 };
0977: public final static String hexString = "0:CCCC:FFFF";
0978:
0979: public short getIndex() {
0980: return index;
0981: }
0982:
0983: public short[] getTriplet() {
0984: return triplet;
0985: }
0986:
0987: public String getHexString() {
0988: return hexString;
0989: }
0990: }
0991:
0992: /**
0993: * Class PLUM
0994: *
0995: */
0996:
0997: public final static class PLUM extends HSSFColor {
0998: public final static short index = 0x3d;
0999: public final static short index2 = 0x19;
1000: public final static short[] triplet = { 153, 51, 102 };
1001: public final static String hexString = "9999:3333:6666";
1002:
1003: public short getIndex() {
1004: return index;
1005: }
1006:
1007: public short[] getTriplet() {
1008: return triplet;
1009: }
1010:
1011: public String getHexString() {
1012: return hexString;
1013: }
1014: }
1015:
1016: /**
1017: * Class GREY_25_PERCENT
1018: *
1019: */
1020:
1021: public final static class GREY_25_PERCENT extends HSSFColor {
1022: public final static short index = 0x16;
1023: public final static short[] triplet = { 192, 192, 192 };
1024: public final static String hexString = "C0C0:C0C0:C0C0";
1025:
1026: public short getIndex() {
1027: return index;
1028: }
1029:
1030: public short[] getTriplet() {
1031: return triplet;
1032: }
1033:
1034: public String getHexString() {
1035: return hexString;
1036: }
1037: }
1038:
1039: /**
1040: * Class ROSE
1041: *
1042: */
1043:
1044: public final static class ROSE extends HSSFColor {
1045: public final static short index = 0x2d;
1046: public final static short[] triplet = { 255, 153, 204 };
1047: public final static String hexString = "FFFF:9999:CCCC";
1048:
1049: public short getIndex() {
1050: return index;
1051: }
1052:
1053: public short[] getTriplet() {
1054: return triplet;
1055: }
1056:
1057: public String getHexString() {
1058: return hexString;
1059: }
1060: }
1061:
1062: /**
1063: * Class TAN
1064: *
1065: */
1066:
1067: public final static class TAN extends HSSFColor {
1068: public final static short index = 0x2f;
1069: public final static short[] triplet = { 255, 204, 153 };
1070: public final static String hexString = "FFFF:CCCC:9999";
1071:
1072: public short getIndex() {
1073: return index;
1074: }
1075:
1076: public short[] getTriplet() {
1077: return triplet;
1078: }
1079:
1080: public String getHexString() {
1081: return hexString;
1082: }
1083: }
1084:
1085: /**
1086: * Class LIGHT_YELLOW
1087: *
1088: */
1089:
1090: public final static class LIGHT_YELLOW extends HSSFColor {
1091: public final static short index = 0x2b;
1092: public final static short[] triplet = { 255, 255, 153 };
1093: public final static String hexString = "FFFF:FFFF:9999";
1094:
1095: public short getIndex() {
1096: return index;
1097: }
1098:
1099: public short[] getTriplet() {
1100: return triplet;
1101: }
1102:
1103: public String getHexString() {
1104: return hexString;
1105: }
1106: }
1107:
1108: /**
1109: * Class LIGHT_GREEN
1110: *
1111: */
1112:
1113: public final static class LIGHT_GREEN extends HSSFColor {
1114: public final static short index = 0x2a;
1115: public final static short[] triplet = { 204, 255, 204 };
1116: public final static String hexString = "CCCC:FFFF:CCCC";
1117:
1118: public short getIndex() {
1119: return index;
1120: }
1121:
1122: public short[] getTriplet() {
1123: return triplet;
1124: }
1125:
1126: public String getHexString() {
1127: return hexString;
1128: }
1129: }
1130:
1131: /**
1132: * Class LIGHT_TURQUOISE
1133: *
1134: */
1135:
1136: public final static class LIGHT_TURQUOISE extends HSSFColor {
1137: public final static short index = 0x29;
1138: public final static short index2 = 0x1b;
1139: public final static short[] triplet = { 204, 255, 255 };
1140: public final static String hexString = "CCCC:FFFF:FFFF";
1141:
1142: public short getIndex() {
1143: return index;
1144: }
1145:
1146: public short[] getTriplet() {
1147: return triplet;
1148: }
1149:
1150: public String getHexString() {
1151: return hexString;
1152: }
1153: }
1154:
1155: /**
1156: * Class PALE_BLUE
1157: *
1158: */
1159:
1160: public final static class PALE_BLUE extends HSSFColor {
1161: public final static short index = 0x2c;
1162: public final static short[] triplet = { 153, 204, 255 };
1163: public final static String hexString = "9999:CCCC:FFFF";
1164:
1165: public short getIndex() {
1166: return index;
1167: }
1168:
1169: public short[] getTriplet() {
1170: return triplet;
1171: }
1172:
1173: public String getHexString() {
1174: return hexString;
1175: }
1176: }
1177:
1178: /**
1179: * Class LAVENDER
1180: *
1181: */
1182:
1183: public final static class LAVENDER extends HSSFColor {
1184: public final static short index = 0x2e;
1185: public final static short[] triplet = { 204, 153, 255 };
1186: public final static String hexString = "CCCC:9999:FFFF";
1187:
1188: public short getIndex() {
1189: return index;
1190: }
1191:
1192: public short[] getTriplet() {
1193: return triplet;
1194: }
1195:
1196: public String getHexString() {
1197: return hexString;
1198: }
1199: }
1200:
1201: /**
1202: * Class WHITE
1203: *
1204: */
1205:
1206: public final static class WHITE extends HSSFColor {
1207: public final static short index = 0x9;
1208: public final static short[] triplet = { 255, 255, 255 };
1209: public final static String hexString = "FFFF:FFFF:FFFF";
1210:
1211: public short getIndex() {
1212: return index;
1213: }
1214:
1215: public short[] getTriplet() {
1216: return triplet;
1217: }
1218:
1219: public String getHexString() {
1220: return hexString;
1221: }
1222: }
1223:
1224: /**
1225: * Class CORNFLOWER_BLUE
1226: */
1227: public final static class CORNFLOWER_BLUE extends HSSFColor {
1228: public final static short index = 0x18;
1229: public final static short[] triplet = { 153, 153, 255 };
1230: public final static String hexString = "9999:9999:FFFF";
1231:
1232: public short getIndex() {
1233: return index;
1234: }
1235:
1236: public short[] getTriplet() {
1237: return triplet;
1238: }
1239:
1240: public String getHexString() {
1241: return hexString;
1242: }
1243: }
1244:
1245: /**
1246: * Class LEMON_CHIFFON
1247: */
1248: public final static class LEMON_CHIFFON extends HSSFColor {
1249: public final static short index = 0x1a;
1250: public final static short[] triplet = { 255, 255, 204 };
1251: public final static String hexString = "FFFF:FFFF:CCCC";
1252:
1253: public short getIndex() {
1254: return index;
1255: }
1256:
1257: public short[] getTriplet() {
1258: return triplet;
1259: }
1260:
1261: public String getHexString() {
1262: return hexString;
1263: }
1264: }
1265:
1266: /**
1267: * Class MAROON
1268: */
1269: public final static class MAROON extends HSSFColor {
1270: public final static short index = 0x19;
1271: public final static short[] triplet = { 153, 51, 102 };
1272: public final static String hexString = "9999:3333:6666";
1273:
1274: public short getIndex() {
1275: return index;
1276: }
1277:
1278: public short[] getTriplet() {
1279: return triplet;
1280: }
1281:
1282: public String getHexString() {
1283: return hexString;
1284: }
1285: }
1286:
1287: /**
1288: * Class ORCHID
1289: */
1290: public final static class ORCHID extends HSSFColor {
1291: public final static short index = 0x1c;
1292: public final static short[] triplet = { 102, 0, 102 };
1293: public final static String hexString = "6666:0:6666";
1294:
1295: public short getIndex() {
1296: return index;
1297: }
1298:
1299: public short[] getTriplet() {
1300: return triplet;
1301: }
1302:
1303: public String getHexString() {
1304: return hexString;
1305: }
1306: }
1307:
1308: /**
1309: * Class CORAL
1310: */
1311: public final static class CORAL extends HSSFColor {
1312: public final static short index = 0x1d;
1313: public final static short[] triplet = { 255, 128, 128 };
1314: public final static String hexString = "FFFF:8080:8080";
1315:
1316: public short getIndex() {
1317: return index;
1318: }
1319:
1320: public short[] getTriplet() {
1321: return triplet;
1322: }
1323:
1324: public String getHexString() {
1325: return hexString;
1326: }
1327: }
1328:
1329: /**
1330: * Class ROYAL_BLUE
1331: */
1332: public final static class ROYAL_BLUE extends HSSFColor {
1333: public final static short index = 0x1e;
1334: public final static short[] triplet = { 0, 102, 204 };
1335: public final static String hexString = "0:6666:CCCC";
1336:
1337: public short getIndex() {
1338: return index;
1339: }
1340:
1341: public short[] getTriplet() {
1342: return triplet;
1343: }
1344:
1345: public String getHexString() {
1346: return hexString;
1347: }
1348: }
1349:
1350: /**
1351: * Class LIGHT_CORNFLOWER_BLUE
1352: */
1353: public final static class LIGHT_CORNFLOWER_BLUE extends HSSFColor {
1354: public final static short index = 0x1f;
1355: public final static short[] triplet = { 204, 204, 255 };
1356: public final static String hexString = "CCCC:CCCC:FFFF";
1357:
1358: public short getIndex() {
1359: return index;
1360: }
1361:
1362: public short[] getTriplet() {
1363: return triplet;
1364: }
1365:
1366: public String getHexString() {
1367: return hexString;
1368: }
1369: }
1370:
1371: /**
1372: * Special Default/Normal/Automatic color.
1373: * <p><i>Note:</i> This class is NOT in the default HashTables returned by HSSFColor.
1374: * The index is a special case which is interpreted in the various setXXXColor calls.
1375: *
1376: * @author Jason
1377: *
1378: */
1379: public final static class AUTOMATIC extends HSSFColor {
1380: private static HSSFColor instance = new AUTOMATIC();
1381:
1382: public final static short index = 0x40;
1383:
1384: public short getIndex() {
1385: return index;
1386: }
1387:
1388: public short[] getTriplet() {
1389: return BLACK.triplet;
1390: }
1391:
1392: public String getHexString() {
1393: return BLACK.hexString;
1394: }
1395:
1396: public static HSSFColor getInstance() {
1397: return instance;
1398: }
1399: }
1400: }
|