Each team plays each other team in ascending numerical order, alternating colours/venues. When a team would be scheduled to play itself, it instead plays the highest-numbered team. This formula gives you two ways to generate each pairing - once from the point of view of each team.