X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbits%2FColorTheme.java;h=1c7c62092c4f7ab7d20048fbad027e380066c4d4;hb=68c5cd6bec3dc425ef5b55fec399d4bdc9afa7cb;hp=d3a468f416dd3d2986282f7b53653d097ffc4a90;hpb=2ce6dab2bbd951e6d0f09f94759efda5ee4b65ac;p=fanfix.git diff --git a/src/jexer/bits/ColorTheme.java b/src/jexer/bits/ColorTheme.java index d3a468f..1c7c620 100644 --- a/src/jexer/bits/ColorTheme.java +++ b/src/jexer/bits/ColorTheme.java @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2016 Kevin Lamonte + * Copyright (C) 2017 Kevin Lamonte * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -32,6 +32,7 @@ import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.io.Reader; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -114,9 +115,20 @@ public final class ColorTheme { * @throws IOException if the I/O fails */ public void load(final String filename) throws IOException { - BufferedReader reader = new BufferedReader(new FileReader(filename)); - String line = reader.readLine(); - for (; line != null; line = reader.readLine()) { + load(new FileReader(filename)); + } + + /** + * Read color theme mappings from a Reader. The reader is closed at the + * end. + * + * @param reader the reader to read from + * @throws IOException if the I/O fails + */ + public void load(final Reader reader) throws IOException { + BufferedReader bufferedReader = new BufferedReader(reader); + String line = bufferedReader.readLine(); + for (; line != null; line = bufferedReader.readLine()) { String key; String bold; String foreColor; @@ -154,7 +166,7 @@ public final class ColorTheme { colors.put(key, color); } // All done. - reader.close(); + bufferedReader.close(); } /** @@ -240,12 +252,12 @@ public final class ColorTheme { color.setBold(false); colors.put("twindow.background.windowmove", color); - // TApplication background + // TDesktop background color = new CellAttributes(); color.setForeColor(Color.BLUE); color.setBackColor(Color.WHITE); color.setBold(false); - colors.put("tapplication.background", color); + colors.put("tdesktop.background", color); // TButton text color = new CellAttributes(); @@ -284,7 +296,7 @@ public final class ColorTheme { // TText text color = new CellAttributes(); color.setForeColor(Color.WHITE); - color.setBackColor(Color.BLACK); + color.setBackColor(Color.BLUE); color.setBold(false); colors.put("ttext", color); @@ -457,7 +469,7 @@ public final class ColorTheme { // TEditor color = new CellAttributes(); color.setForeColor(Color.WHITE); - color.setBackColor(Color.BLACK); + color.setBackColor(Color.BLUE); color.setBold(false); colors.put("teditor", color);