does red(color) work?
in
Processing with Other Languages
•
1 year ago
I want to pass the color i use in processingjs to javascript as a sring so i can do something with it.
I tested with returning "rgb(255, 0, 0)" , <- as a string not a function! And that worked, i was able to set a underline in red.
However i can't create the string in processing with the actual colors.
I get this error in the dev console:
Uncaught TypeError: number is not a function
It goes wrong on this line:
float rf = red(c);
Is it broken?
- String returnSectionColor() {
- if (javascript!=null) {
- consoleLog("a");
- color c = colors[selectedRow];
- float rf = red(c);
- consoleLog("b");
- /*
- int r = int(red(colors[selectedRow]));
- int g = int(green(colors[selectedRow]));
- int b = int(blue(colors[selectedRow]));
- */
- int r = 255;
- int g = 55;
- int b = 50;
- consoleLog("c");
- consoleLog("rgb("+r+", "+g+", "+b+")");
- return "rgb("+r+", "+g+", "+b+")";
- }
- return null;
- }
1