In a baryon there are 3 quarks and in a meson there are one quark + one anti-quark.
So color charge is colorless ( a color singlet state ) in a meson.
But how is it colorless in a baryon?
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It only takes a minute to sign up.Sign up to join this community
Please refer to the answer in the previous question , of why do quarks change color.
In rephrasing your present question to "why are baryons color neutral" the answer is simple: because that is what we have observed. No "color' quantum number characterizes a baryon. On "how" baryons manage to be color neutral is : because we have fitted the data with mathematical structures which can accurately describe color neutral baryons made up of colored quarks.
In its simplest form a "baryon" means either a proton or a neutron. In the mathematics describing this observation the term "isospin" has been defined, and a baryon with isospin +1/2 is the proton, and -1/2 is the neutron. This allows to use the algebra of the SU(2) group symmetries when writing down equations to calculate the behavior in experiments of protons and neutrons. This was extended to all the resonances seen .
When quarks were discovered to exist within the baryons it became necessary to assign new quantum numbers to them, because the experiments could only be fitted if a complicated symmetry ,called SU(3) color, was assigned to their behavior in a similar way as the SU(2) symmetry to the baryons. The three colors is a fancy way of saying that there are three quantum numbers involved in the strong interaction which characterize quarks. These colors follow the rules of the SU(3) group structure. These rules allow summing up colored quarks and gluons within a baryon, into a color neutral state consistent with the SU(3) structure. This permits writing out integrals ( Feynman diagrams) to calculate the behavior of quark quark interactions even though there are no free quarks in the final states.( The reason there are no free quarks is due to the form of the potential of the strong interaction, but that is another story. )
This link gives the mathematics of what I have tried to describe in words.