I was making a program like this:
void setup() {
}
void draw() {
background(splitColorV2("RGB:"+(int)random(255)+":"+(int)random(255)+":"+(int)random(255)+":255"));
noLoop();
}
void mousePressed() {loop();}
color splitColorV2(String input) {
String parameters[] = split(input,":");
printArray(parameters);
String mode = parameters[0];
int p1 = int(parameters[1]), p2 = int(parameters[2]), p3 = int(parameters[3]),a = ((parameters.length == 5)? int(parameters[4]) : 255);
println(parameters.length);
if(mode == "RGB") {
return color(p1,p2,p3,a);
} else {
color convertedColor = toRGB(p1,p2,p3,a);
return convertedColor;
}
}
color toRGB(int h, int s, int b, int a) {
return(color(h,s,b,a));
}