Blink light and stop by sending command to Serial

There are a couple of things to consider here.

You need a better solution to handle Serial input... you should be checking for the end of input (such as a CR character), and you can't assume that the input can keep up with the Arduino. So you might get the the end of the serial buffer and not have read everything yet. You need to handle this, and allow the program to continue... and check the Serial buffer again for the rest of the message on the next loop.

You need to hold the previous command received while you are waiting for the next one to arrive.

To enable blinking use something like millis(s) to count the time to switch on/off... rather than blocking with something like delay(1000). If you have a variable that holds this information you can use when you decide which lights to turn on/off.

Here's an example...

#define Red   10
#define Green 11 
#define Blue  9
  
String command = "off";
char newCommand[10];
int idx = 0;
char rcvdChar;

float currTime, prevTime = 0;  
boolean blink = false;
   
void setup() 
{
  pinMode(Red,   OUTPUT);
  pinMode(Green, OUTPUT);
  pinMode(Blue,  OUTPUT);
  
  Serial.begin(9600); 

  prevTime = millis();
}

void readFromSerial()
{
  while (Serial.available() > 0)
  {
    char rcvdChar = Serial.read();

    if (rcvdChar == 0x0D) // End of input
    {
      newCommand[idx] = 0x00;
      
      command = newCommand;

      Serial.print("Command received: ");
      Serial.println(command);
      
      idx = 0;
    }
    else
    {
      newCommand[idx] = rcvdChar;
      idx++;
    }      
  }
}

void setLights()
{
  if (command == "off")
  {
    digitalWrite(Red,   LOW);
    digitalWrite(Green, LOW);
    digitalWrite(Blue,  LOW); 
    return;
  }
  
  if (command == "red")
  {
    digitalWrite(Red,   blink);
    digitalWrite(Green, LOW);
    digitalWrite(Blue,  LOW);  
    return;  
  }
  
  if (command == "green")
  {
    digitalWrite(Red,   LOW);
    digitalWrite(Green, blink);
    digitalWrite(Blue,  LOW);  
    return;  
  }

  if (command == "blue")
  {
    digitalWrite(Red,   LOW);
    digitalWrite(Green, LOW);
    digitalWrite(Blue,  blink);    
    return;
  }
}

void setBlink(int delay)
{
  currTime = millis();
  
  if (currTime > prevTime + delay)
  {
    prevTime = currTime;  
    
    blink = !blink;

    Serial.print("Blinking: ");
    Serial.println(blink);
  }   
}


  
void loop() 
{
  readFromSerial();

  setBlink(1000);  

  setLights();
}