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