JAL-1360 refactored utility method to ColorUtils class
[jalview.git] / src / jalview / util / ColorUtils.java
index f108da1..0d726a2 100644 (file)
@@ -59,4 +59,29 @@ public class ColorUtils
 
   }
 
+/**
+   * Returns a colour three shades darker. 
+   * 
+   * We use darker text to indicate unselected buttons, lighter text for selected. Note you can't 
+   * guarantee that darkerThan/brighterThan undo each other, as they may result in black/white.
+   * 
+   * @param col
+   * @return
+   */
+  public static Color darkerThan(Color col) {
+         return col.darker().darker().darker();
+  }
+
+/**
+   * Returns a colour three shades brighter. 
+   * 
+   * We use darker text to indicate unselected buttons, lighter text for selected. Note you can't 
+   * guarantee that darkerThan/brighterThan undo each other, as they may result in black/white.
+   * @param col
+   * @return
+   */
+  public static Color brighterThan(Color col) {
+         return col.brighter().brighter().brighter();
+  }
+
 }