X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbits%2FColorTheme.java;h=e55398a8235f38b4677f2dc9cd81edf514cdf735;hb=6f8ff91a29056209f9fd5f40e2dcf1ae285e0210;hp=1c7c62092c4f7ab7d20048fbad027e380066c4d4;hpb=499fdccfad144aa58869d839d50edb898670626a;p=fanfix.git diff --git a/src/jexer/bits/ColorTheme.java b/src/jexer/bits/ColorTheme.java index 1c7c620..e55398a 100644 --- a/src/jexer/bits/ColorTheme.java +++ b/src/jexer/bits/ColorTheme.java @@ -130,27 +130,39 @@ public final class ColorTheme { String line = bufferedReader.readLine(); for (; line != null; line = bufferedReader.readLine()) { String key; - String bold; + boolean bold = false; + boolean blink = false; String foreColor; String backColor; + String token; // Look for lines that resemble: // "key = blah on blah" // "key = bold blah on blah" + // "key = blink bold blah on blah" + // "key = bold blink blah on blah" + // "key = blink blah on blah" StringTokenizer tokenizer = new StringTokenizer(line); key = tokenizer.nextToken(); if (!tokenizer.nextToken().equals("=")) { // Skip this line continue; } - bold = tokenizer.nextToken(); - if (!bold.toLowerCase().equals("bold")) { - // "key = blah on blah" - foreColor = bold; - } else { - // "key = bold blah on blah" - foreColor = tokenizer.nextToken().toLowerCase(); + token = tokenizer.nextToken(); + while (token.equals("bold") || token.equals("blink")) { + if (token.equals("bold")) { + bold = true; + token = tokenizer.nextToken(); + } + if (token.equals("blink")) { + blink = true; + token = tokenizer.nextToken(); + } } + + // What's left is "blah on blah" or "blah" + foreColor = token.toLowerCase(); + if (!tokenizer.nextToken().toLowerCase().equals("on")) { // Skip this line continue; @@ -158,9 +170,12 @@ public final class ColorTheme { backColor = tokenizer.nextToken().toLowerCase(); CellAttributes color = new CellAttributes(); - if (bold.equals("bold")) { + if (bold) { color.setBold(true); } + if (blink) { + color.setBlink(true); + } color.setForeColor(Color.getColor(foreColor)); color.setBackColor(Color.getColor(backColor)); colors.put(key, color);