X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbits%2FColorTheme.java;h=eaa351cb12d7b2d5e86011ddb17bd24f04f04395;hb=3649b9210ea425f398ba8c24f9509669cf72aa96;hp=60f706e3b10574d6dd40461194cf22525674a3c4;hpb=cf9af8df455c0ea5390e4c0ed2555506a051a379;p=fanfix.git diff --git a/src/jexer/bits/ColorTheme.java b/src/jexer/bits/ColorTheme.java index 60f706e..eaa351c 100644 --- a/src/jexer/bits/ColorTheme.java +++ b/src/jexer/bits/ColorTheme.java @@ -1,4 +1,4 @@ -/** +/* * Jexer - Java Text User Interface * * License: LGPLv3 or later @@ -34,6 +34,9 @@ import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; import java.util.SortedMap; import java.util.StringTokenizer; import java.util.TreeMap; @@ -68,6 +71,29 @@ public final class ColorTheme { return attr; } + /** + * Retrieve all the names in the theme. + * + * @return a list of names + */ + public List getColorNames() { + Set keys = colors.keySet(); + List names = new ArrayList(keys.size()); + names.addAll(keys); + return names; + } + + /** + * Set the color for a named theme color. + * + * @param name theme color name, e.g. "twindow.border" + * @param color the new color to associate with name, e.g. bold yellow on + * blue + */ + public void setColor(final String name, final CellAttributes color) { + colors.put(name, color); + } + /** * Save the color theme mappings to an ASCII file. * @@ -230,7 +256,7 @@ public final class ColorTheme { color.setBold(false); colors.put("tbutton.inactive", color); color = new CellAttributes(); - color.setForeColor(Color.WHITE); + color.setForeColor(Color.CYAN); color.setBackColor(Color.GREEN); color.setBold(true); colors.put("tbutton.active", color); @@ -391,27 +417,27 @@ public final class ColorTheme { color.setBold(true); colors.put("ttreeview.inactive", color); - // TText text + // TList color = new CellAttributes(); color.setForeColor(Color.WHITE); color.setBackColor(Color.BLUE); color.setBold(false); - colors.put("tdirectorylist", color); + colors.put("tlist", color); color = new CellAttributes(); color.setForeColor(Color.BLACK); color.setBackColor(Color.CYAN); color.setBold(false); - colors.put("tdirectorylist.selected", color); + colors.put("tlist.selected", color); color = new CellAttributes(); color.setForeColor(Color.BLACK); color.setBackColor(Color.CYAN); color.setBold(false); - colors.put("tdirectorylist.unreadable", color); + colors.put("tlist.unreadable", color); color = new CellAttributes(); color.setForeColor(Color.BLACK); color.setBackColor(Color.BLUE); color.setBold(true); - colors.put("tdirectorylist.inactive", color); + colors.put("tlist.inactive", color); // TEditor color = new CellAttributes();