org.riotfamily.common.util
Class ColorUtils

java.lang.Object
  extended by org.riotfamily.common.util.ColorUtils

public final class ColorUtils
extends Object

Since:
6.5
Author:
Felix Gnass [fgnass at neteye dot de]

Constructor Summary
ColorUtils()
           
 
Method Summary
static Color brightness(Color c, float scale)
          Adjusts the brightness of the given color.
static Color parseColor(String s)
          Creates a Color instance from a String.
static Color saturation(Color c, float scale)
          Adjusts the saturation of the given color.
static String toHex(Color c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorUtils

public ColorUtils()
Method Detail

parseColor

public static Color parseColor(String s)
                        throws IllegalArgumentException
Creates a Color instance from a String. Supported formats are:
 #fff
 #ffffff
 rgb(255,155,155)
 rgb(100%,100%,100%)
 
You may also use one of the color names listed at http://www.w3schools.com/css/css_colornames.asp

Throws:
IllegalArgumentException

brightness

public static Color brightness(Color c,
                               float scale)
Adjusts the brightness of the given color.

Parameters:
c - The color to adjust
scale - The factor (a value from -1 to 1)

saturation

public static Color saturation(Color c,
                               float scale)
Adjusts the saturation of the given color.

Parameters:
c - The color to adjust
scale - The factor (a value from -1 to 1)

toHex

public static String toHex(Color c)