org.browsecode.helpers.images
Class HexConversion
java.lang.Object
org.browsecode.helpers.images.HexConversion
public class HexConversion
- extends java.lang.Object
Convert between HTML hex colors and regular colors.
The original source from this was public domain on the web. Unfortunately, the original author and credits have been lost.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HexConversion
public HexConversion()
getColor
public static java.awt.Color getColor(java.lang.String hex)
getColorFromHTML
public static java.awt.Color getColorFromHTML(java.lang.String hex)
getHex
public static java.lang.String getHex(java.awt.Color c)
intToHex
public static java.lang.String intToHex(int b)
twoCharEachHexStringToInts
public static int[] twoCharEachHexStringToInts(java.lang.String str)
hexStringToInt
public static int hexStringToInt(java.lang.String str)
hexCharToInt
public static int hexCharToInt(char c)
- convert a single hex char to corresponding int.
- Parameters:
c
- char to convert. must be 0-9 a-f A-F, no
spaces, plus or minus signs.
- Returns:
- corresponding integer