You only check colors on resolution and not later when the damage prevention actually is applied.

Artwork
Loading artwork…
Guard Dogs
Planeshift · #5 · EN
Nonfoil—Foil—
Card rules
2
,
: Choose a permanent you control. Prevent all combat damage target creature would deal this turn if it shares a color with that permanent.
2/2
"A good guard is alert. A great guard is also loyal." —Benalish kennelmaster
Uncommon · Illustrated by Mike Raabe
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
PreDH Legal
Premodern Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Modern Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
Pioneer Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Tlr Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
You choose the target on activation and choose the permanent which is compared for color on resolution.