code: public static Color colorFromRbgString( String rbgString ) {
          String[] split = rbgString.split(",");
          if (split.length < 3 || split.length > 4) {
              throw new IllegalArgumentException("Color string has to be of type r,g,b.");
          }
          int r = (int) Double.parseDouble(split[0].trim());
          int g = (int) Double.parseDouble(split[1].trim());
          int b = (int) Double.parseDouble(split[2].trim());
          Color c = null;
          if (split.length == 4) {
              // alpha
              int a = (int) Double.parseDouble(split[3].trim());
              c = new Color(r, g, b, a);
          } else {
              c = new Color(r, g, b);
          }
  
          return c;
      }
docs: Converts a color string.
  
  @param rbgString the string in the form "r,g,b,a" as integer values between 0 and 255.
  @return the {@link Color}.