need help, I cant make the code work using serial readstring

int redLed = 9;
int grLed = 10;
int blueLed = 11;
String myColor;
String msg1 = "What color do you want?" ;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(redLed, OUTPUT);
pinMode(grLed, OUTPUT);
pinMode(blueLed, OUTPUT);

}

void loop() {
// put your main code here, to run repeatedly:
Serial.println(msg1);
while (Serial.available() == 0) {
}
myColor = Serial.readString();
if (myColor == "green") {
digitalWrite(grLed, HIGH);
digitalWrite(redLed, LOW);
digitalWrite(blueLed, LOW);
}
if (myColor == "off") {
digitalWrite(grLed, LOW);
digitalWrite(redLed, LOW);
digitalWrite(blueLed, LOW);
}
if (myColor == "white") {
digitalWrite(grLed, HIGH);
digitalWrite(redLed, HIGH);
digitalWrite(blueLed, HIGH);
}

if (myColor == "red") {
digitalWrite(grLed, LOW);
digitalWrite(redLed, HIGH);
digitalWrite(blueLed, LOW);
}
if (myColor == "blue") {
digitalWrite(grLed, LOW);
digitalWrite(redLed, LOW);
digitalWrite(blueLed, HIGH);
}
if (myColor == "yellow") {
analogWrite(grLed, 255);
analogWrite(redLed, 255);
analogWrite(blueLed, 0);
}
if (myColor == "orange") {
analogWrite(grLed, 50);
analogWrite(redLed, 255);
analogWrite(blueLed, 0);
}
if (myColor == "aqua") {
analogWrite(grLed, 255);
analogWrite(redLed, 0);
analogWrite(blueLed, 200);
}
if (myColor == "violet") {
analogWrite(grLed, 0);
analogWrite(redLed, 150);
analogWrite(blueLed, 155);
}

}

the Serial.readString() is probably reads the line terminator into the string
try String.startsWith() method, e.g.if (myColor.startsWith("violet"))

while (Serial.available() == 0)

The code in this while loop only runs when there is no serial data available

I strongly suspect that you meant

while (Serial.available() != 0)

so that it runs when serial data is available

I think there is a loop waiting for a Serial.available() none zero

while (Serial.available() == 0) {
  }

Have a look at the examples in Serial Input Basics - simple reliable non-blocking ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

...R

I also recommend Robin2's serial input basics. It reads serial data into a null terminated character array and so avoids the potential memory problems when using the String class. Also his methods are not blocking. The readString function is a blocking function.

Read the how to use this forum-please read sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.