public static Color convertToColor(String cssValue){
  Color col=null;
  if (cssValue != null && !cssValue.isEmpty()) {
    if (cssValue.startsWith("#")) {
      col=Color.decode(cssValue);
    }
 else {
      if (cssValue.startsWith("rgb")) {
        col=handleRGBColor(cssValue);
      }
 else {
        col=handleNamedColor(cssValue.toLowerCase());
      }
    }
  }
  return col;
}

public static Color convertToColor ( String cssValue ) { Color col = null ; if ( cssValue != null && ! cssValue . isEmpty ( ) ) { if ( cssValue . startsWith ( "#" ) ) { col = Color . decode ( cssValue ) ; } else { if ( cssValue . startsWith ( "rgb" ) ) { col = handleRGBColor ( cssValue ) ; } else { col = handleNamedColor ( cssValue . toLowerCase ( ) ) ; } } } return col ; }
accepts a valid css1 color value and return a color object .
