While remembering the colors and finding ways to play your cards are both important. At it's core, this is actually a disguised game of Nim.
When you start a fresh rainbow, always make sure to play exactly 2 cards. That way, since your opponent has 4 open spots, they will always have to leave 1, 2, or 3 spots open for your next turn. Allowing you to complete the row.
Playing only 1 card would allow your opponent to take back the advantage by also playing a single card, leaving you with 4 open spots. Playing 3 cards on a fresh board would leave your opponent free to try to finish the rainbow on their next turn.
If there are already 2 cards on the table only add one as you would be unable to finish in one go.
If there are already 3 cards on the table attempt to finish in one go.
Take into account what colors are revealed to each player.