using tsc3200 as 2-tone card detection (1 card with combination of 2 color)

im curently in project where i need to accessing a servo using tsc3200. one color is okay but now i need to fiqure out how make it into 2 color.

the illustration is when I shift/slide a card colored with a combination of two specific colors in front of tsc3200, the servo will move. but as far as I know the colored object must be immovable when in front of the tsc3200 so that it can be read properly. and also how to save two colors as condition we want in if statement, not just one color.

p.s only can use 1 tsc3200 and also the card must be shifted from left to right or vice versa.

#include <Servo.h>
#define S0 2
#define S1 3
#define S2 4
#define S3 5
#define sensorOut 6

Servo servo;

int frequency = 0;
int color=0;

void setup() {
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
pinMode(sensorOut, INPUT);

digitalWrite(S0, HIGH);
digitalWrite(S1, HIGH);

servo.attach(8);

Serial.begin(9600);
}
void loop() {

color = readColor();
delay(10);
switch (color) {
// case 1:
// servo.write(50);
// break;
// case 2:
// servo.write(75);
// break;
case 3:
servo.write(0);
break;
case 4:
servo.write(180);
break;
// case 5:
// servo.write(150);
// break;
// case 6:
// servo.write(175);
// break;

}
delay(300);

color=0;
}

int readColor() {
// RED
digitalWrite(S2, LOW);
digitalWrite(S3, LOW);
frequency = pulseIn(sensorOut, LOW);
int R = frequency;
Serial.print("R= ");
Serial.print(frequency);
Serial.print(" ");
delay(50);

//GREEN
digitalWrite(S2, HIGH);
digitalWrite(S3, HIGH);
frequency = pulseIn(sensorOut, LOW);
int G = frequency;
Serial.print("G= ");
Serial.print(frequency);
Serial.print(" ");
delay(50);

// BLUE
digitalWrite(S2, LOW);
digitalWrite(S3, HIGH);
frequency = pulseIn(sensorOut, LOW);
int B = frequency;
Serial.print("B= ");
Serial.print(frequency);
Serial.println(" ");
delay(50);

//if(R<45 & R>32 & G<65 & G>55){
// color = 1; // Red
//}
// if(G<55 & G>43 & B<47 & B>35){
// color = 2; // Orange
// }
if(R<105 & R>90 & G<65 & G>50)
{
color = 3; // Green
}
if(R<25 & R>15 & G<35 & G>25){
color = 4; // Yellow
}
//if(R<56 & R>46 & G<65 & G>55){
// color = 5; // Brown
// }
// if (G<58 & G>45 & B<40 &B>26){
// color = 6; // Blue
//}
return color;
}

im currently using this code for one color detection.

Please edit your post to add code tags, as described in the "How to use this forum" post.

as far as I know the colored object must be immovable when in front of the tsc3200 so that it can be read properly.

Why do you think this?

Even if true, how long does it take the sensor to make one reading? Consult the data sheet for the answer, wait that long, store the result and shift the card for the second reading.