Solution:
We first give an example of a league with 8n3−4n2 teams.
Split the colours in two sets of size n/2. Let m=n/2 and let c1,…,cm and d1,…,dm be the colours in those sets.
Consider all pairs of kits of the form ({ci,cj},dk) or ({di,dj},ck), where i<j and 1≤i,j,k≤m. There are 2⋅(2m)⋅m=m3−m2=8n3−4n2 such pairs of kits. We claim that this construction is valid.
Consider any pair of kits ({ci,cj},dk). Then for any other team of the form ({ca,cb},du), the kit du is not clashing with the home kit {ci,cj}. Furthermore, for any team of the form ({da,db},cu) the kit {da,db} is not clashing with the home kit {ci,cj}. Thus, the construction is valid.
We now prove that there is no larger league. Consider any colour c. Take any other colour d. If there is a team whose home kit is {c,d}, then there is no team whose home kit contains c and whose away kit is d. Conversely, if there is a team whose home kit contains c and whose away kit is d, then there is no team whose home kit is {c,d}.
Let A(c) be the number of colours d such that there is a home kit of the form {c,d}, and let B(c) the number of colours d such that there is a team whose home kit contains c and whose away kit is d.
From the observation we made, A(c)+B(c)≤n−1. The number of teams whose home kit contains the colour c is at most
A(c)B(c)≤2n−2⋅2n−1=4n2−2n
where the inequality follows from the fact that the function x↦x(n−1−x) is increasing on (0,(n−1)/2) and decreasing on ((n−1)/2,n−1).
Summing up over all colours c and dividing by 2 since we counted each home kit twice, we obtain that the number of teams is at most
21c∑A(c)B(c)≤2n⋅(4n2−2n)=8n3−4n2.