Color sort in autons?

Here is my code for my color sort, I am curious on how to make it run in the background for autonimous.

void redColorSort(){
  bool redBall;  
  float newHue=Optical20.hue();
  //std::cout<<newHue<<endl;
  if(newHue<=35 && newHue>= 0){
    redBall=true;
    FullIntake9.spin(reverse, 100, pct);
    Half8.spin(reverse, 100, pct);
    Half10.spin(reverse, 100, pct);//spin scoring motors
  }
  if(newHue<=200 && newHue>= 160){
    redBall=false;
    FullIntake9.spin(reverse, 100, pct);
    Half8.spin(reverse, 100, pct);
    Half10.spin(fwd, 100, pct);//spin wrong motors
  }
  
}

I would probably have the robot use the intake to pick up the block and then run the color sort. Something like:

//insert code to run intake system
redColorSort();