bibliothek.util
Class Colors

java.lang.Object
  extended by bibliothek.util.Colors

public final class Colors
extends java.lang.Object

Some fields and methods that make life easier when dealing with Colors.

Author:
Benjamin Sigg

Method Summary
static java.awt.Color between(java.awt.Color a, java.awt.Color b, double value)
          Creates a color which "lies between" the colors a and b
static java.awt.Color brighter(java.awt.Color color)
          Helper methods calling Color.brighter().
static java.awt.Color brighter(java.awt.Color c, double value)
          Increases the brightness of a color.
static java.awt.Color darker(java.awt.Color color)
          Helper methods calling Color.darker().
static java.awt.Color darker(java.awt.Color c, double value)
          Decreases the brightness of a color.
static java.awt.Color deltaBrightness(java.awt.Color c, double delta)
          Converts c into HSB and adds delta to the brightness.
static java.awt.Color diffMirror(java.awt.Color color, double factor)
           
static java.awt.Color fuller(java.awt.Color color, double factor)
           
static java.awt.Color middle(java.awt.Color a, java.awt.Color b)
           
static java.awt.Color undiffMirror(java.awt.Color color, double factor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

darker

public static java.awt.Color darker(java.awt.Color c,
                                    double value)
Decreases the brightness of a color.

Parameters:
c - the color which will be made darker
value - how much darker the color should be, 1 means black, 0 means c is returned
Returns:
a color which is darker than c

brighter

public static java.awt.Color brighter(java.awt.Color c,
                                      double value)
Increases the brightness of a color.

Parameters:
c - the color which will be made brighter
value - how much brighter the color should be, 1 means white, 0 means c is returned
Returns:
a color which is brighter than c

deltaBrightness

public static java.awt.Color deltaBrightness(java.awt.Color c,
                                             double delta)
Converts c into HSB and adds delta to the brightness.

Parameters:
c - the color to convert
delta - the delta in brightness
Returns:
the new color

between

public static java.awt.Color between(java.awt.Color a,
                                     java.awt.Color b,
                                     double value)
Creates a color which "lies between" the colors a and b

Parameters:
a - the first color
b - the second color
value - a value between 0 and 1, 0 means a is returned, 1 means b is returned
Returns:
a color whose rgb-values are between the rgb-values of a and b

middle

public static java.awt.Color middle(java.awt.Color a,
                                    java.awt.Color b)

fuller

public static java.awt.Color fuller(java.awt.Color color,
                                    double factor)

undiffMirror

public static java.awt.Color undiffMirror(java.awt.Color color,
                                          double factor)

diffMirror

public static java.awt.Color diffMirror(java.awt.Color color,
                                        double factor)

darker

public static java.awt.Color darker(java.awt.Color color)
Helper methods calling Color.darker().

Parameters:
color - some color to modify, can be null
Returns:
the darker color or null

brighter

public static java.awt.Color brighter(java.awt.Color color)
Helper methods calling Color.brighter().

Parameters:
color - some color to modify, can be null
Returns:
the brighter color or null