Add 'src/jexer/' from commit 'cf01c92f5809a0732409e280fb0f32f27393618d'
[nikiroo-utils.git] / src / jexer / bits / ColorTheme.java
index 1c4670a76f3e04dd0297bd83d4915b8662149aa8..ffba4d472cc67c36ebda4114e503ba1db545c719 100644 (file)
@@ -3,7 +3,7 @@
  *
  * The MIT License (MIT)
  *
- * Copyright (C) 2017 Kevin Lamonte
+ * Copyright (C) 2019 Kevin Lamonte
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -78,7 +78,7 @@ public class ColorTheme {
      * @return color associated with name, e.g. bold yellow on blue
      */
     public CellAttributes getColor(final String name) {
-        CellAttributes attr = (CellAttributes) colors.get(name);
+        CellAttributes attr = colors.get(name);
         return attr;
     }
 
@@ -153,7 +153,8 @@ public class ColorTheme {
             try {
                 foreColorRGB = Integer.parseInt(tokenizer.nextToken(), 16);
             } catch (NumberFormatException e) {
-                e.printStackTrace();
+                // Default to white on black
+                foreColorRGB = 0xFFFFFF;
             }
 
             // "on"
@@ -167,7 +168,7 @@ public class ColorTheme {
             try {
                 backColorRGB = Integer.parseInt(tokenizer.nextToken(), 16);
             } catch (NumberFormatException e) {
-                e.printStackTrace();
+                backColorRGB = 0;
             }
 
             CellAttributes color = new CellAttributes();
@@ -361,6 +362,11 @@ public class ColorTheme {
         color.setBackColor(Color.BLUE);
         color.setBold(true);
         colors.put("tlabel", color);
+        color = new CellAttributes();
+        color.setForeColor(Color.YELLOW);
+        color.setBackColor(Color.BLUE);
+        color.setBold(true);
+        colors.put("tlabel.mnemonic", color);
 
         // TText text
         color = new CellAttributes();
@@ -371,14 +377,14 @@ public class ColorTheme {
 
         // TField text
         color = new CellAttributes();
-        color.setForeColor(Color.WHITE);
-        color.setBackColor(Color.BLUE);
+        color.setForeColor(Color.BLACK);
+        color.setBackColor(Color.WHITE);
         color.setBold(false);
         colors.put("tfield.inactive", color);
         color = new CellAttributes();
-        color.setForeColor(Color.YELLOW);
-        color.setBackColor(Color.BLACK);
-        color.setBold(true);
+        color.setForeColor(Color.BLACK);
+        color.setBackColor(Color.CYAN);
+        color.setBold(false);
         colors.put("tfield.active", color);
 
         // TCheckBox
@@ -392,6 +398,16 @@ public class ColorTheme {
         color.setBackColor(Color.BLACK);
         color.setBold(true);
         colors.put("tcheckbox.active", color);
+        color = new CellAttributes();
+        color.setForeColor(Color.YELLOW);
+        color.setBackColor(Color.BLUE);
+        color.setBold(true);
+        colors.put("tcheckbox.mnemonic", color);
+        color = new CellAttributes();
+        color.setForeColor(Color.RED);
+        color.setBackColor(Color.BLACK);
+        color.setBold(true);
+        colors.put("tcheckbox.mnemonic.highlighted", color);
 
         // TComboBox
         color = new CellAttributes();
@@ -455,6 +471,16 @@ public class ColorTheme {
         color.setBackColor(Color.BLACK);
         color.setBold(true);
         colors.put("tradiobutton.active", color);
+        color = new CellAttributes();
+        color.setForeColor(Color.YELLOW);
+        color.setBackColor(Color.BLUE);
+        color.setBold(true);
+        colors.put("tradiobutton.mnemonic", color);
+        color = new CellAttributes();
+        color.setForeColor(Color.RED);
+        color.setBackColor(Color.BLACK);
+        color.setBold(true);
+        colors.put("tradiobutton.mnemonic.highlighted", color);
 
         // TRadioGroup
         color = new CellAttributes();
@@ -608,6 +634,45 @@ public class ColorTheme {
         color.setBold(false);
         colors.put("teditor", color);
 
+        // TTable
+        color = new CellAttributes();
+        color.setForeColor(Color.WHITE);
+        color.setBackColor(Color.BLUE);
+        color.setBold(false);
+        colors.put("ttable.inactive", color);
+        color = new CellAttributes();
+        color.setForeColor(Color.BLACK);
+        color.setBackColor(Color.CYAN);
+        color.setBold(false);
+        colors.put("ttable.active", color);
+        color = new CellAttributes();
+        color.setForeColor(Color.YELLOW);
+        color.setBackColor(Color.CYAN);
+        color.setBold(true);
+        colors.put("ttable.selected", color);
+        color = new CellAttributes();
+        color.setForeColor(Color.BLACK);
+        color.setBackColor(Color.WHITE);
+        color.setBold(false);
+        colors.put("ttable.label", color);
+        color = new CellAttributes();
+        color.setForeColor(Color.BLUE);
+        color.setBackColor(Color.WHITE);
+        color.setBold(false);
+        colors.put("ttable.label.selected", color);
+        color = new CellAttributes();
+        color.setForeColor(Color.WHITE);
+        color.setBackColor(Color.BLUE);
+        color.setBold(false);
+        colors.put("ttable.border", color);
+
+        // TSplitPane
+        color = new CellAttributes();
+        color.setForeColor(Color.WHITE);
+        color.setBackColor(Color.BLUE);
+        color.setBold(false);
+        colors.put("tsplitpane", color);
+
     }
 
     /**