-2

I want to send a sting from processing js to javascript with the color to use in css. so formatted like: "rgb(255, 0, 0)" (or whatever color values).

no matter what i try i get this error:

Uncaught TypeError: number is not a function

I did several tests and it is always red(.... that is causing the error (and probably green and blue).

String getRowColor(int r) {
  if (r > rows || r < 0) {
    return null;
  } 
  else {
    color c= colors[r];
    String cStr = "rgb(";
    cStr += red(c)+", ";
    cStr += green(c)+", ";
    cStr += blue(c)+")";
    return cStr;
  }
}
Christian Neverdal
  • 5,655
  • 6
  • 38
  • 93
clankill3r
  • 9,146
  • 20
  • 70
  • 126

1 Answers1

-1

I think that: color c= colors[r]; should be: color c= color(r);

Arnaldof
  • 174
  • 11