static final Color hexToColor(String value){
  String digits;
  int n=value.length();
  if (value.startsWith("#")) {
    digits=value.substring(1,Math.min(value.length(),7));
  }
 else {
    digits=value;
  }
  String hstr="0x" + digits;
  Color c;
  try {
    c=Color.decode(hstr);
  }
 catch (  NumberFormatException nfe) {
    c=null;
  }
  return c;
}

static final Color hexToColor ( String value ) { String digits ; int n = value . length ( ) ; if ( value . startsWith ( "#" ) ) { digits = value . substring ( 1 , Math . min ( value . length ( ) , 7 ) ) ; } else { digits = value ; } String hstr = "0x" + digits ; Color c ; try { c = Color . decode ( hstr ) ; } catch ( NumberFormatException nfe ) { c = null ; } return c ; }
convert a " # ffffff " hex string to a color . if the color specification is bad , an attempt will be made to fix it up .
