Send color data from Processing to Arduino

Hello,

I am trying to send color data from Processing to Arduino.

Here is my Arduino sketch: GetColor

void setup() {
  Serial.begin(115200);
}

void loop() {
  if(Serial.available()){
   int val = Serial.read();
   Serial.println(val);

  }
 }

Here is the Processing sketch:

import processing.serial.*;

Serial myPort;
void setup()
{
    background( 0 );
    println(Serial.list());
    myPort = new Serial(this, Serial.list()[7], 115200);
}


void draw()
{
    if(myPort.available > 0){
    color mycolor= color(225,0,0);
    myPort.write(mycolor);
    }
    
}

I know it is a matter of data types but i do not know which is sending or getting which. I think from Arduino side, i have to get a string like "255, 0 ,0" and string format and put it in an array value like colorValues[255, 0, 0];

Something similar but in reverse fashion in this example.

Anyone have any idea how to achieve this?

Thanks

There is so much wrong with that Processing code that is hard to know where to begin.

    if(myPort.available > 0){
    color mycolor= color(225,0,0);
    myPort.write(mycolor);
    }

If Processing is to be driving the Arduino, why is it waiting for the Arduino so send something? If there is something to read, why aren't you reading it?

What do you expect to be writing to the port when you write an object? If you want to send the string "255, 0, 0", send that string. If you want to send the color of something, get the r, g, and b components from the color, and send those. Be SURE to send some kind of delimiter, so the Arduino knows when one packet ends and the next begins.

I am sorry, i do not know much programming, but your tone of reply is not encouraging for a beginner. If you do want code reviews do somewhere else.