Fix some default colours
authorNiki Roo <niki@nikiroo.be>
Sat, 2 Apr 2016 12:20:25 +0000 (14:20 +0200)
committerNiki Roo <niki@nikiroo.be>
Sat, 2 Apr 2016 12:20:25 +0000 (14:20 +0200)
src/be/nikiroo/jvcard/resources/colors.properties
src/be/nikiroo/jvcard/tui/UiColors.java

index 7d0bd2c20a1cd012b9f43864b5d25b37f955e5fc..3cf0b491d66b1002c296d65e3743dbdbd4121382 100644 (file)
@@ -11,8 +11,8 @@
 
 
 # (FORMAT: colour)
-DEFAULT_FG = BLACK
-DEFAULT_BG = WHITE
+DEFAULT_FG = WHITE
+DEFAULT_BG = BLACK
 # (FORMAT: colour)
 TITLE_MAIN_FG = WHITE
 TITLE_MAIN_BG = BLUE
index 877c73964defee82004f1e4c76ffb1ad685fbc72..7d951c8d06869dee17ce3ebd9b8398148fb8875d 100644 (file)
@@ -34,6 +34,55 @@ public class UiColors extends ColorBundle {
                colorMap = new HashMap<String, TextColor>();
        }
 
+       /**
+        * Return a {@link Theme} following the colours defined in
+        * colors.properties.
+        * 
+        * @return the {@link Theme}
+        */
+       static public Theme getCustomTheme() {
+               // Create a properties-theme with our own custom values for some of it
+               Properties properties = new Properties();
+               try {
+                       ClassLoader classLoader = AbstractTextGUI.class.getClassLoader();
+                       InputStream resourceAsStream = classLoader
+                                       .getResourceAsStream("default-theme.properties");
+                       if (resourceAsStream == null) {
+                               resourceAsStream = new FileInputStream(
+                                               "src/main/resources/default-theme.properties");
+                       }
+                       properties.load(resourceAsStream);
+                       resourceAsStream.close();
+               } catch (IOException e) {
+               }
+
+               // default colours:
+               String fg = getForegroundColor(ColorOption.DEFAULT).toString();
+               String bg = getBackgroundColor(ColorOption.DEFAULT).toString();
+               for (String def : new String[] { "com.googlecode.lanterna",
+                               "com.googlecode.lanterna.gui2.TextBox",
+                               "com.googlecode.lanterna.gui2.AbstractListBox",
+                               "com.googlecode.lanterna.gui2.Borders$StandardBorder" }) {
+                       properties.put(def + ".foreground", fg);
+                       properties.put(def + ".background", bg);
+               }
+
+               // no bold on borders prelight:
+               properties
+                               .put("com.googlecode.lanterna.gui2.Borders$StandardBorder.sgr[PRELIGHT]",
+                                               "");
+
+               // line answers:
+               fg = getForegroundColor(ColorOption.LINE_MESSAGE_ANS).toString();
+               bg = getBackgroundColor(ColorOption.LINE_MESSAGE_ANS).toString();
+               String prop = "com.googlecode.lanterna.gui2.TextBox";
+               properties.put(prop + ".foreground[ACTIVE]", fg);
+               properties.put(prop + ".background[ACTIVE]", bg);
+
+               PropertiesTheme theme = new PropertiesTheme(properties);
+               return theme;
+       }
+
        /**
         * Create a new {@link Label} with the colours of the given
         * {@link ColorOption}.
@@ -113,33 +162,6 @@ public class UiColors extends ColorBundle {
                return getInstance().colorMap.get(el.name() + "_FG");
        }
 
-       /**
-        * Return a {@link Theme} following the colours defined in
-        * display.properties.
-        * 
-        * @return the {@link Theme}
-        */
-       static Theme getCustomTheme() {
-               // Create a properties-theme with our own custom values for some of it
-               Properties properties = new Properties();
-               try {
-                       ClassLoader classLoader = AbstractTextGUI.class.getClassLoader();
-                       InputStream resourceAsStream = classLoader
-                                       .getResourceAsStream("default-theme.properties");
-                       if (resourceAsStream == null) {
-                               resourceAsStream = new FileInputStream(
-                                               "src/main/resources/default-theme.properties");
-                       }
-                       properties.load(resourceAsStream);
-                       resourceAsStream.close();
-               } catch (IOException e) {
-               }
-               properties.put("com.googlecode.lanterna.background", "black");
-               PropertiesTheme theme = new PropertiesTheme(properties);
-
-               return theme;
-       }
-
        /**
         * Get the (unique) instance of this class.
         *