I was chatting with user Dan Yand regarding my recent question about colour charges, it was mentioned in the comment section that particles with colour charges attract each other like or unlike hence I would like to know how do quarks keep themselves apart? It can't be electromagnetic force because it is much weaker than strong force so how about exclusion principle similar to electron degeneracy pressure in compact star but that way it will become a gluon plasma soup?
The attractive color force actually gets weaker as quarks get closer together. This is called asymptotic freedom, and it was discovered as a property of QCD in 1973. Since quarks become non-interacting at short distances, there is no need for a force to keep them apart.
The opposite is also true: the attractive color force stays strong as the quarks get arbitrarily far apart. It essentially approaches a constant value. This is called confinement.