1 19 20 package jxl.format; 21 22 27 public class Colour 28 { 29 32 private int value; 33 34 37 private RGB rgb; 38 39 43 private String string; 44 45 48 private static Colour[] colours = new Colour[0]; 49 50 59 protected Colour(int val, String s, int r, int g, int b) 60 { 61 value = val; 62 string = s; 63 rgb = new RGB(r,g,b); 64 65 Colour[] oldcols = colours; 66 colours = new Colour[oldcols.length + 1]; 67 System.arraycopy(oldcols, 0, colours, 0, oldcols.length); 68 colours[oldcols.length] = this; 69 } 70 71 77 public int getValue() 78 { 79 return value; 80 } 81 82 87 public String getDescription() 88 { 89 return string; 90 } 91 92 99 public int getDefaultRed() 100 { 101 return rgb.getRed(); 102 } 103 104 111 public int getDefaultGreen() 112 { 113 return rgb.getGreen(); 114 } 115 116 123 public int getDefaultBlue() 124 { 125 return rgb.getBlue(); 126 } 127 128 133 public RGB getDefaultRGB() 134 { 135 return rgb; 136 } 137 138 144 public static Colour getInternalColour(int val) 145 { 146 for (int i = 0 ; i < colours.length ; i++) 147 { 148 if (colours[i].getValue() == val) 149 { 150 return colours[i]; 151 } 152 } 153 154 return UNKNOWN; 155 } 156 157 162 public static Colour[] getAllColours() 163 { 164 return colours; 165 } 166 167 public final static Colour UNKNOWN = 169 new Colour(0x7fee, "unknown", 0, 0, 0); 170 public final static Colour BLACK = 171 new Colour(0x7fff, "black", 0, 0, 0); 172 public final static Colour WHITE = 173 new Colour(0x9, "white", 0xff, 0xff, 0xff); 174 public final static Colour DEFAULT_BACKGROUND1 175 = new Colour(0x0, "default background", 0xff, 0xff, 0xff); 176 public final static Colour DEFAULT_BACKGROUND 177 = new Colour(0xc0, "default background", 0xff, 0xff, 0xff); 178 public final static Colour PALETTE_BLACK = 179 new Colour(0x8, "black", 0x1, 0, 0); 180 182 public final static Colour RED = new Colour(0xa, "red",0xff,0,0); 184 public final static Colour BRIGHT_GREEN = new Colour(0xb, "bright green",0,0xff,0); 185 public final static Colour BLUE = new Colour(0xc, "blue",0,0,0xff); public final static Colour YELLOW = new Colour(0xd, "yellow",0xff,0xff,0); 186 public final static Colour PINK = new Colour(0xe, "pink",0xff,0,0xff); 187 public final static Colour TURQUOISE = new Colour(0xf, "turquoise",0,0xff,0xff); 188 public final static Colour DARK_RED = new Colour(0x10, "dark red",0x80,0,0); 189 public final static Colour GREEN = new Colour(0x11, "green",0,0x80,0); 190 public final static Colour DARK_BLUE = new Colour(0x12, "dark blue",0,0,0x80); 191 public final static Colour DARK_YELLOW = new Colour(0x13, "dark yellow",0x80,0x80,0); 192 public final static Colour VIOLET = new Colour(0x14, "violet",0x80,0x80,0); 193 public final static Colour TEAL = new Colour(0x15, "teal",0,0x80,0x80); 194 public final static Colour GREY_25_PERCENT = new Colour(0x16 ,"grey 25%",0xc0,0xc0,0xc0); 195 public final static Colour GREY_50_PERCENT = new Colour(0x17, "grey 50%",0x80,0x80,0x80); 196 public final static Colour PERIWINKLE = new Colour(0x18, "periwinkle%",0x99, 0x99, 0xff); 197 public final static Colour PLUM2 = new Colour(0x19, "plum",0x99, 0x33, 0x66); 198 public final static Colour IVORY = new Colour(0x1a, "ivory",0xff, 0xff, 0xcc); 199 public final static Colour LIGHT_TURQUOISE2= new Colour(0x1b, "light turquoise",0xcc, 0xff, 0xff); 200 public final static Colour DARK_PURPLE = new Colour(0x1c, "dark purple",0x66, 0x0, 0x66); 201 public final static Colour CORAL = new Colour(0x1d, "coral",0xff, 0x80, 0x80); 202 public final static Colour OCEAN_BLUE = new Colour(0x1e, "ocean blue",0x0, 0x66, 0xcc); 203 public final static Colour ICE_BLUE = new Colour(0x1f, "ice blue",0xcc, 0xcc, 0xff); 204 public final static Colour DARK_BLUE2 = new Colour(0x20, "dark blue",0,0,0x80); 205 public final static Colour PINK2 = new Colour(0x21, "pink",0xff,0,0xff); 206 public final static Colour YELLOW2 = new Colour(0x22, "yellow",0xff,0xff,0x0); 207 public final static Colour TURQOISE2 = new Colour(0x23, "turqoise",0x0,0xff,0xff); 208 public final static Colour VIOLET2 = new Colour(0x24, "violet",0x80,0x0,0x80); 209 public final static Colour DARK_RED2 = new Colour(0x25, "dark red",0x80,0x0,0x0); 210 public final static Colour TEAL2 = new Colour(0x26, "teal",0x0,0x80,0x80); 211 public final static Colour BLUE2 = new Colour(0x27, "blue",0x0,0x0,0xff); 212 public final static Colour SKY_BLUE = new Colour(0x28, "sky blue",0,0xcc,0xff); 213 public final static Colour LIGHT_TURQUOISE 214 = new Colour(0x29, "light turquoise",0xcc,0xff,0xff); 215 public final static Colour LIGHT_GREEN = new Colour(0x2a, "light green",0xcc,0xff,0xcc); 216 public final static Colour VERY_LIGHT_YELLOW 217 = new Colour(0x2b, "very light yellow",0xff,0xff,0x99); 218 public final static Colour PALE_BLUE = new Colour(0x2c, "pale blue",0x99,0xcc,0xff); 219 public final static Colour ROSE = new Colour(0x2d, "rose",0xff,0x99,0xcc); 220 public final static Colour LAVENDER = new Colour(0x2e, "lavender",0xcc,0x99,0xff); 221 public final static Colour TAN = new Colour(0x2f, "tan",0xff,0xcc,0x99); 222 public final static Colour LIGHT_BLUE = new Colour(0x30, "light blue", 0x33, 0x66, 0xff); 223 public final static Colour AQUA = new Colour(0x31, "aqua",0x33,0xcc,0xcc); 224 public final static Colour LIME = new Colour(0x32, "lime",0x99,0xcc,0); 225 public final static Colour GOLD = new Colour(0x33, "gold",0xff,0xcc,0); 226 public final static Colour LIGHT_ORANGE 227 = new Colour(0x34, "light orange",0xff,0x99,0); 228 public final static Colour ORANGE = new Colour(0x35, "orange",0xff,0x66,0); 229 public final static Colour BLUE_GREY = new Colour(0x36, "blue grey",0x66,0x66,0xcc); 230 public final static Colour GREY_40_PERCENT = new Colour(0x37, "grey 40%",0x96,0x96,0x96); 231 public final static Colour DARK_TEAL = new Colour(0x38, "dark teal",0,0x33,0x66); 232 public final static Colour SEA_GREEN = new Colour(0x39, "sea green",0x33,0x99,0x66); 233 public final static Colour DARK_GREEN = new Colour(0x3a, "dark green",0,0x33,0); 234 public final static Colour OLIVE_GREEN = new Colour(0x3b, "olive green",0x33,0x33,0); 235 public final static Colour BROWN = new Colour(0x3c, "brown",0x99,0x33,0); 236 public final static Colour PLUM = new Colour(0x3d, "plum",0x99,0x33,0x66); 237 public final static Colour INDIGO = new Colour(0x3e, "indigo",0x33,0x33,0x99); 238 public final static Colour GREY_80_PERCENT = new Colour(0x3f, "grey 80%",0x33,0x33,0x33); 239 public final static Colour AUTOMATIC = new Colour(0x40, "automatic", 0xff, 0xff, 0xff); 240 241 public final static Colour GRAY_80 = GREY_80_PERCENT; 243 public final static Colour GRAY_50 = GREY_50_PERCENT; 244 public final static Colour GRAY_25 = GREY_25_PERCENT; 245 } 246 247 248 249 250 251 252 253 254 255 256 257 | Popular Tags |