com.mxgraph.util

## Class mxHtmlColor

- java.lang.Object
- - com.mxgraph.util.mxHtmlColor

-     public class mxHtmlColor
      extends java.lang.Object

  Contains various helper methods for use with mxGraph.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.util.HashMap<java.lang.String,java.awt.Color>` | `htmlColors` HTML color lookup table.
    `protected static java.util.regex.Pattern` | `rgbRegex`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `mxHtmlColor()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `getHexColorString(java.awt.Color color)` Returns a hex representation for the given color.
    `static java.lang.String` | `hexString(java.awt.Color color)`
    `protected static float` | `parseAlpha(java.lang.String alpha)`
    `static java.awt.Color` | `parseColor(java.lang.String str)` Shortcut for parseColor with no transparency.
    `static java.awt.Color` | `parseColor(java.lang.String str, double alpha)` Convert a string representing a 24/32bit hex color value into a Color object.
    `protected static double` | `parsePercent(java.lang.String perc)`
    `protected static java.awt.Color` | `parseRgb(java.lang.String rgbString)`
    `protected static float` | `parseValue(java.lang.String val, int max)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### htmlColors

          protected static java.util.HashMap<java.lang.String,java.awt.Color> htmlColors

      HTML color lookup table. Supports the 147 CSS color names.

    - #### rgbRegex

          protected static final java.util.regex.Pattern rgbRegex

  - ### Constructor Detail

    - #### mxHtmlColor

          public mxHtmlColor()

  - ### Method Detail

    - #### hexString

          public static java.lang.String hexString(java.awt.Color color)

    - #### getHexColorString

          public static java.lang.String getHexColorString(java.awt.Color color)

      Returns a hex representation for the given color.
      Parameters:
        `color` - Color to return the hex string for.
      Returns:
        Returns a hex string for the given color.

    - #### parseColor

          public static java.awt.Color parseColor(java.lang.String str)
                                           throws java.lang.NumberFormatException

      Shortcut for parseColor with no transparency.
      Throws:
        `java.lang.NumberFormatException`

    - #### parseColor

          public static java.awt.Color parseColor(java.lang.String str,
                                  double alpha)
                                           throws java.lang.NumberFormatException

      Convert a string representing a 24/32bit hex color value into a Color object. All 147 CSS color names and none are also supported. None returns null. Examples of possible hex color values are: #C3D9FF, #6482B9 and #774400, but note that you do not include the "#" in the string passed in
      Parameters:
        `str` - the 24/32bit hex string value (ARGB)
      Returns:
        java.awt.Color (24bit RGB on JDK 1.1, 24/32bit ARGB on JDK1.2)
      Throws:
        `java.lang.NumberFormatException` - if the specified string cannot be interpreted as a hexidecimal integer

    - #### parseRgb

          protected static java.awt.Color parseRgb(java.lang.String rgbString)

    - #### parseValue

          protected static float parseValue(java.lang.String val,
                         int max)

    - #### parsePercent

          protected static double parsePercent(java.lang.String perc)

    - #### parseAlpha

          protected static float parseAlpha(java.lang.String alpha)

Copyright (c) 2010 Gaudenz Alder. All rights reserved.