1 21 22 package org.armedbear.j; 23 24 import java.awt.Color ; 25 import java.awt.Font ; 26 27 public final class DefaultTheme 28 { 29 public static final Color getColor(String thing) 30 { 31 return getColor(null, thing); 32 } 33 34 public static final Color getColor(String mode, String thing) 36 { 37 if (thing == null) 38 return null; 39 thing = thing.intern(); 40 if (mode != null) { 41 mode = mode.intern(); 42 if (mode == "CSSMode") { 43 if (thing == "selector") 44 return new Color (0, 0, 0); 45 if (thing == "property") 46 return new Color (0, 0, 204); 47 } else if (mode == "DiffMode") { 48 if (thing == "file") 49 return new Color (0, 0, 0); 50 if (thing == "header") 51 return new Color (0, 102, 0); 52 if (thing == "context") 53 return new Color (0, 0, 0); 54 if (thing == "inserted") 55 return new Color (153, 0, 0); 56 if (thing == "deleted") 57 return new Color (0, 0, 153); 58 } else if (mode == "DirectoryMode") { 59 if (thing == "directory") 60 return new Color (0, 0, 0); 61 if (thing == "symlink") 62 return new Color (0, 0, 255); 63 if (thing == "marked") 64 return new Color (153, 0, 0); 65 } else if (mode == "HtmlMode") { 66 if (thing == "tag") 67 return new Color (0, 0, 153); 68 if (thing == "anchor") 69 return new Color (51, 153, 51); 70 if (thing == "image") 71 return new Color (204, 102, 0); 72 if (thing == "table") 73 return new Color (204, 0, 0); 74 if (thing == "tableRow") 75 return new Color (153, 0, 0); 76 if (thing == "tableData") 77 return new Color (153, 51, 0); 78 if (thing == "comment") 79 return new Color (128, 128, 128); 80 if (thing == "script") 81 return new Color (0, 0, 255); 82 } else if (mode == "ListOccurrencesMode") { 83 if (thing == "headerName") 84 return new Color (0, 0, 153); 85 if (thing == "headerValue") 86 return new Color (0, 0, 255); 87 } else if (mode == "MailboxMode") { 88 if (thing == "to") 89 return new Color (0, 0, 0); 90 if (thing == "flags") 91 return new Color (0, 0, 0); 92 if (thing == "date") 93 return new Color (51, 51, 51); 94 if (thing == "from") 95 return new Color (0, 0, 0); 96 if (thing == "size") 97 return new Color (51, 51, 51); 98 if (thing == "subject") 99 return new Color (51, 102, 102); 100 if (thing == "flaggedTo") 101 return new Color (204, 51, 0); 102 if (thing == "flaggedFlags") 103 return new Color (0, 0, 0); 104 if (thing == "flaggedDate") 105 return new Color (0, 0, 0); 106 if (thing == "flaggedFrom") 107 return new Color (204, 51, 0); 108 if (thing == "flaggedSize") 109 return new Color (0, 0, 0); 110 if (thing == "flaggedSubject") 111 return new Color (204, 51, 0); 112 if (thing == "marked") 113 return new Color (153, 0, 0); 114 if (thing == "deleted") 115 return new Color (153, 153, 153); 116 } else if (mode == "MessageMode") { 117 if (thing == "headerName") 118 return new Color (0, 0, 153); 119 if (thing == "headerValue") 120 return new Color (51, 102, 102); 121 if (thing == "signature") 122 return new Color (102, 102, 102); 123 if (thing == "string") 124 return new Color (0, 102, 0); 125 if (thing == "comment") 126 return new Color (102, 102, 102); 127 } else if (mode == "WebMode") { 128 if (thing == "headerValue") 129 return new Color (51, 102, 102); 130 } else if (mode == "LispMode") { 131 if (thing == "substitution") 132 return new Color (153, 0, 153); 133 if (thing == "punctuation") 134 return new Color (102, 102, 102); 135 if (thing == "parenthesis") 136 return new Color (102, 102, 102); 137 if (thing == "secondaryKeyword") 138 return new Color (0, 102, 153); 139 } else if (mode == "PerlMode") { 140 if (thing == "scalar") 141 return new Color (51, 51, 0); 142 if (thing == "list") 143 return new Color (0, 51, 51); 144 } else if (mode == "PHPMode") { 145 if (thing == "var") 146 return new Color (51, 51, 0); 147 if (thing == "tag") 148 return new Color (0, 0, 0); 149 if (thing == "attribute") 150 return new Color (0, 0, 128); 151 if (thing == "equals") 152 return new Color (0, 153, 153); 153 } else if (mode == "TclMode") { 154 if (thing == "brace") 155 return new Color (153, 0, 51); 156 if (thing == "bracket") 157 return new Color (204, 102, 0); 158 } else if (mode == "VHDLMode") { 159 if (thing == "type") 160 return new Color (0, 0, 255); 161 } else if (mode == "PropertiesMode") { 162 if (thing == "section") 163 return new Color (0, 0, 153); 164 } else if (mode == "XmlMode") { 165 if (thing == "attribute") 166 return new Color (0, 0, 128); 167 if (thing == "equals") 168 return new Color (0, 153, 153); 169 if (thing == "namespace") 170 return new Color (0, 0, 0); 171 if (thing == "tag") 172 return new Color (0, 0, 0); 173 } 174 } 175 176 if (thing == "text") 177 return new Color (0, 0, 0); 178 if (thing == "background") 179 return new Color (255, 255, 224); 180 if (thing == "caret") 181 return new Color (255, 0, 0); 182 if (thing == "verticalRule") 183 return new Color (204, 204, 204); 184 if (thing == "selectionBackground") 185 return new Color (153, 204, 255); 186 if (thing == "matchingBracketBackground") 187 return new Color (153, 204, 255); 188 if (thing == "preprocessor") 189 return new Color (255, 0, 0); 190 if (thing == "comment") 191 return new Color (0, 102, 0); 192 if (thing == "keyword") 193 return new Color (0, 0, 153); 194 if (thing == "brace") 195 return new Color (0, 128, 128); 196 if (thing == "number") 197 return new Color (153, 102, 51); 198 if (thing == "currentLineBackground") 199 return new Color (235, 235, 204); 200 if (thing == "function") 201 return new Color (0, 0, 0); 202 if (thing == "string") 203 return new Color (153, 51, 0); 204 if (thing == "operator") 205 return new Color (0, 0, 255); 206 if (thing == "disabled") 207 return new Color (153, 153, 153); 208 if (thing == "change") 209 return new Color (255, 164, 0); 210 if (thing == "savedChange") 211 return new Color (180, 180, 180); 212 if (thing == "lineNumber") 213 return new Color (153, 153, 153); 214 if (thing == "gutterBorder") 215 return new Color (153, 153, 153); 216 if (thing == "prompt") 217 return new Color (0, 0, 0); 218 if (thing == "input") 219 return new Color (0, 0, 255); 220 if (thing == "matchingText") 221 return new Color (204, 102, 0); 222 if (thing == "status") 223 return new Color (0, 0, 153); 224 if (thing == "key") 225 return new Color (0, 0, 153); 226 if (thing == "value") 227 return new Color (128, 0, 0); 228 if (thing == "delimiter") 229 return new Color (0, 153, 153); 230 231 if (thing == "target") 233 return new Color (0, 0, 0); 234 235 if (thing == "link") 237 return new Color (0, 0, 255); 238 239 if (thing == "registerPrefix") 241 return new Color (0, 0, 153); 242 if (thing == "registerName") 243 return new Color (204, 102, 0); 244 245 return null; 247 } 248 249 public static final int getStyle(String mode, String thing) 252 { 253 if (thing == null) 254 return -1; 255 thing = thing.intern(); 256 if (mode != null) { 257 mode = mode.intern(); 258 if (mode == "CSSMode") { 259 if (thing == "selector") 260 return Font.BOLD; 261 if (thing == "property") 262 return Font.PLAIN; 263 } else if (mode == "DiffMode") { 264 if (thing == "file") 265 return Font.BOLD; 266 if (thing == "header") 267 return Font.ITALIC; 268 } else if (mode == "MailboxMode") { 269 if (thing == "to") 270 return Font.BOLD; 271 if (thing == "date") 272 return Font.PLAIN; 273 if (thing == "from") 274 return Font.BOLD; 275 if (thing == "subject") 276 return Font.BOLD; 277 if (thing == "flaggedTo") 278 return Font.BOLD; 279 if (thing == "flaggedFrom") 280 return Font.BOLD; 281 if (thing == "flaggedSubject") 282 return Font.BOLD; 283 if (thing == "marked") 284 return Font.BOLD; 285 } else if (mode == "MessageMode") { 286 if (thing == "headerName") 287 return Font.BOLD; 288 if (thing == "headerValue") 289 return Font.BOLD; 290 if (thing == "comment") 291 return Font.PLAIN; 292 } else if (mode == "WebMode") { 293 if (thing == "headerValue") 294 return Font.BOLD; 295 } else if (mode == "ListOccurrencesMode") { 296 if (thing == "headerName") 297 return Font.BOLD; 298 } else if (mode == "PropertiesMode") { 299 if (thing == "section") 300 return Font.BOLD; 301 else if (thing == "comment") 302 return Font.ITALIC; 303 else 304 return Font.PLAIN; 305 } else if (mode == "DirectoryMode") { 306 if (thing == "directory") 307 return Font.BOLD; 308 if (thing == "marked") 309 return Font.BOLD; 310 } else if (mode == "TclMode") { 311 if (thing == "brace") 312 return Font.BOLD; 313 if (thing == "bracket") 314 return Font.BOLD; 315 } else if (mode == "XmlMode" || mode == "PHPMode" ) { 316 if (thing == "tag") 317 return Font.BOLD; 318 } else if (mode == "MakefileMode") { 319 if (thing == "target") 320 return Font.BOLD; 321 } 322 } 323 324 if (thing == "keyword") 325 return Font.BOLD; 326 if (thing == "function") 327 return Font.BOLD; 328 if (thing == "prompt") 329 return Font.BOLD; 330 if (thing == "comment") 331 return Font.ITALIC; 332 if (thing == "matchingText") 333 return Font.BOLD; 334 if (thing == "status") 335 return Font.ITALIC; 336 if (thing == "key") 337 return Font.PLAIN; 338 if (thing == "delimiter") 339 return Font.BOLD; 340 341 if (thing == "registerPrefix") 343 return Font.BOLD; 344 if (thing == "registerName") 345 return Font.BOLD; 346 347 return -1; 349 } 350 } 351 | Popular Tags |