Lightweigth HTML Scanner 2.00

Class HTMLColors


public class HTMLColors
extends java.lang.Object

Static helper class for HTML color value interpretation. Because many HTML tags take color attributes, and the decoding of color names and values is quite lengthy and not as straightforward as it seems, we wrote this class to do it for you. It has a single static method getColor(String)

See Also:
HTML Color names

Method Summary
static java.awt.Color getColor(java.lang.String sColor)
          Convenience method for HTML color value interpretation.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail


public static java.awt.Color getColor(java.lang.String sColor)
Convenience method for HTML color value interpretation. Translates "#RRGGBB" color numbers or one of the MSIE/Netscape predefined Color names to a java.awt.Color object, just as forgivingly as MSIE and Netscape do it. Only if a numeric value exceeds 6 hex digits, this method does not reflect MSIE or Netscape behaviour; it currently uses only the first 6 digits but this behaviour may change as soon as we figure out exactly how the browsers do it.

sColor - The color name or number. May be null or an empty String.
a valid Color object
See Also:
HTML Color names

Lightweigth HTML Scanner 2.00