X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FColorUtils.java;h=fd760862fdfcafa70938a49f2c787abbb58b7d94;hb=e0273ccaa778d70fea45dcca68b31f0cb66310f0;hp=0d726a2470613aa1bb6da09fde79fea6ac4def17;hpb=b369b306448bbec72f29b33ebe2f654589845103;p=jalview.git diff --git a/src/jalview/util/ColorUtils.java b/src/jalview/util/ColorUtils.java index 0d726a2..fd76086 100644 --- a/src/jalview/util/ColorUtils.java +++ b/src/jalview/util/ColorUtils.java @@ -59,29 +59,28 @@ 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. + /** + * Returns a colour three shades darker. Note you can't guarantee that + * brighterThan reverses this, as darkerThan may result in black. * * @param col * @return */ - public static Color darkerThan(Color col) { - return col.darker().darker().darker(); + public static Color darkerThan(Color col) + { + return col == null ? null : col.darker().darker().darker(); } -/** - * Returns a colour three shades brighter. + /** + * Returns a colour three shades brighter. Note you can't guarantee that + * darkerThan reverses this, as brighterThan may result in white. * - * 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(); + public static Color brighterThan(Color col) + { + return col == null ? null : col.brighter().brighter().brighter(); } }