Your trainer card when you begin the game is colored red. When you complete certain tasks, stars are added onto your card as a sort of prestigious recognition for your efforts. In the same way as in the previous generation of Pokemon, these stars will be accompanied by the change of your card's color. They are typically obtained in order.
Blue Trainer Card (One Star)-Beat the Elite Four
Bronze Trainer Card (Two Stars)-Defeat all of the Master Rank Contests
Silver Trainer Card (Three Stars)-Complete the Underground Flag minigame with friends
Gold Trainer Card (Four Stars)-Capture 482 different Pokemon
Black Trainer Card (Five Stars)-Win 100 times in a row at the Battle Tower