Hence 3 fermions are in the same state which violates the Pauli Exclusion Principle. The solution was to introduce a new degree of freedom called Colour . There are 3 colours red , blue and green . The 3 quarks in the have different colours and the Pauli Principle is no longer violated. For each colour there is the corresponding anti-colour.
Mesons consist of a coloured quark plus and antiquark with the corresponding anticolour.
Again making a colourless state. The strong interaction is carried by 8 massless vector gluons . This is in contrast to electromagnetism where the photon does not have electric charge. Consider a proton made up of one red, one green and one blue quark. If one performs a global colour transformation of red green everywhere, then the colourless proton remains colourless - nothing has changed.