org.xwiki.gwt.wysiwyg.client.plugin.color
Class ColorConverter

java.lang.Object
  extended by org.xwiki.gwt.wysiwyg.client.plugin.color.ColorConverter

public class ColorConverter
extends Object

Utility class for converting between different color formats.

Version:
$Id: f6b37f09324fc5d43596fb08825f5fe45074a761 $

Constructor Summary
ColorConverter()
           
 
Method Summary
 String colorNameToHex(String colorName)
           
 String convertToHex(String color)
          Converts the specified color code to hex code (as in #F0F0EE).
 String decimalToHex(String color)
           
 String rgbToHex(String rgbColor)
          Converts a RGB expression to hex code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorConverter

public ColorConverter()
Method Detail

convertToHex

public String convertToHex(String color)
Converts the specified color code to hex code (as in #F0F0EE). The following input formats are supported: . The input color is returned unchanged if it is already a hex code.

Parameters:
color - a color code, in one of the supported formats
Returns:
the hex code of the specified color, null if there's no matching hex code

rgbToHex

public String rgbToHex(String rgbColor)
Converts a RGB expression to hex code.

Parameters:
rgbColor - a RGB expression
Returns:
the hex color code matching the given RGB expression

colorNameToHex

public String colorNameToHex(String colorName)
Parameters:
colorName - a CSS color name
Returns:
the hex code matching the specified color

decimalToHex

public String decimalToHex(String color)
Parameters:
color - a decimal color code (Internet Explorer specific format)
Returns:
the hex code matching the specified color


Copyright © 2004–2014 XWiki. All rights reserved.