com.jalios.util
Class ColorUtil

java.lang.Object
  extended by com.jalios.util.ColorUtil

public class ColorUtil
extends Object

This class provides utility methods to manage colors.

Since:
jcms-5.5.0
Version:
$Revision: 27751 $
Author:
Olivier Dedieu

Field Summary
static String REVISION
           
 
Constructor Summary
ColorUtil()
           
 
Method Summary
static Color addOffset(Color color, int offset)
          Add an offset to the given color and return the corresponding color
static String addOffset(String colorStr, int offset)
          Add an offset to the given color and return an hexadecimal representation of the corresponding color
static Color getColor(String colorStr)
          Return a color from a given hexadecimal string (eg #FF0000 will return a pure red.
static String getStringColor(Color color)
          Returns the hexadecimal represention of this color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values
Constructor Detail

ColorUtil

public ColorUtil()
Method Detail

getColor

public static Color getColor(String colorStr)
Return a color from a given hexadecimal string (eg #FF0000 will return a pure red. Leading # is optional).

Parameters:
colorStr - the string to be parsed
Returns:
a Color (or null if a parsing error occured)
Since:
jcms-5.5.0

getStringColor

public static String getStringColor(Color color)
Returns the hexadecimal represention of this color. Eg for a pure red color (100%, 0, 0), it returns "#ff0000"

Parameters:
color - the color to process
Returns:
the hexadecimal represention of this color.
Since:
jcms-5.5.0

addOffset

public static String addOffset(String colorStr,
                               int offset)
Add an offset to the given color and return an hexadecimal representation of the corresponding color

Parameters:
colorStr - the hexadecimal representation of the color (eg. "#ff0000");
offset - the offset to apply
Returns:
an hexadecimal representation of the modified color
Since:
jcms-5.5.0
See Also:
addOffset(Color, int)

addOffset

public static Color addOffset(Color color,
                              int offset)
Add an offset to the given color and return the corresponding color

Parameters:
color - the color to process
offset - the offset to apply
Returns:
the modified color
Since:
jcms-5.5.0
See Also:
addOffset(String, int)


Copyright © 2001-2010 Jalios SA. All Rights Reserved.