code: public static Color toColor(final String colorString) {
          String trimmedString = colorString.trim();
          Color color = null;
          if (trimmedString.startsWith("#")) {
              final int shortHexCode = 4;
              if (trimmedString.length() == shortHexCode) {
                  StringBuilder builder = new StringBuilder("#");
                  for (int i = 1; i < trimmedString.length(); i++) {
                      builder.append(trimmedString.charAt(i));
                      builder.append(trimmedString.charAt(i));
                  }
                  color = SLD.toColor(builder.toString());
              } else {
                  color = SLD.toColor(trimmedString);
              }
          }
  
          if (color == null) {
              color = parseRgbColor(trimmedString);
          }
  
          if (color == null) {
              color = parseRgbaColor(trimmedString);
          }
  
          if (color == null) {
              color = parseHslColor(trimmedString);
          }
  
          if (color == null) {
              color = parseHslaColor(trimmedString);
          }
  
          if (color == null) {
              final Field[] fields = Color.class.getFields();
              for (Field field: fields) {
                  if (field.getType() == Color.class && Modifier.isFinal(field.getModifiers())
                          && Modifier.isStatic(field.getModifiers()) &&
                          field.getName().equalsIgnoreCase(trimmedString)) {
                      try {
                          return (Color) field.get(null);
                      } catch (IllegalAccessException e) {
                          throw new Error(e);
                      }
                  }
              }
              color = Color.decode(trimmedString);
          }
  
          return color;
      }
docs: Parse the string and convert it to a {@link java.awt.Color}.  See class description for details on the
  supported color formats.
  
  @param colorString the color string encoded.