import java.util.HashMap;
import java.util.Map;
+import java.util.MissingResourceException;
import java.util.ResourceBundle;
import be.nikiroo.jvcard.resources.Bundles;
*/
private TextColor getBackgroundColor(Element el) {
if (!colorMap.containsKey(el.name() + "_BG")) {
- String value = bundle.getString(el.name() + "_BG");
+ String value = null;
+ try {
+ value = bundle.getString(el.name() + "_BG");
+ } catch (MissingResourceException mre) {
+ value = null;
+ }
colorMap.put(el.name() + "_BG",
convertToColor(value, TextColor.ANSI.BLACK));
}
*/
private TextColor getForegroundColor(Element el) {
if (!colorMap.containsKey(el.name() + "_FG")) {
- String value = bundle.getString(el.name() + "_FG");
+ String value = null;
+ try {
+ value = bundle.getString(el.name() + "_FG");
+ } catch (MissingResourceException mre) {
+ value = null;
+ }
colorMap.put(el.name() + "_FG",
convertToColor(value, TextColor.ANSI.WHITE));
}
int g = Integer.parseInt(value.substring(3, 5), 16);
int b = Integer.parseInt(value.substring(5, 7), 16);
return new TextColor.RGB(r, g, b);
+ } else if (value.replaceAll("[0-9]*", "").length() == 0) {
+ return new TextColor.Indexed(Integer.parseInt(value));
} else {
return TextColor.ANSI.valueOf(value);
}