After taking out seven, there are two balls left. There are two possibilities for their colors.
1 The two balls are the same color, indicating that the other two balls have been completely taken out.
The colors of the two balls are different, which means that the ball of the other color has been completely taken out.
So take at least seven balls.
To be clear, when you take out six balls, the worst case is that two red, yellow and blue balls are completely taken out, and then you take another ball, no matter what color, three balls of this color are already in your hand.