Well, you could give them Resistance, though they would still be able to hit each other without taking damage.
Otherwise you could like send out rays and if they hit a player you summon an armorstand in front of the raycasting player so they can't punch the other player.
Or just give up the color thing and have them in the same team
Yeah I just realised I could have the same team :D. Thanks anyway!
I wish they would add an option for players being on multiple teams :(((