Quick answer: For sweat stains on colored shirts, first remove the body oil with dish soap or an enzymatic stain remover, then treat the yellowing with oxygen bleach or 3% hydrogen peroxide. Wash cold, do not tumble dry until the stain is gone, and repeat if needed.
Sweat stains on colored shirts are usually not just sweat. The yellowing comes from body oil, or sebum, oxidizing over time, which is why old stains can look darker and more set-in. If the shirt also has odor, you may be dealing with bacteria trapped in the oil as well.
The key is to treat the stain in the right order: remove the oily residue first, then use an oxygen bleach treatment to lift the discoloration.
For smaller yellow sweat stains on colored shirts, spray on 3% hydrogen peroxide and let it air dry. It works slowly, so patience matters. Keep the shirt out of direct sunlight while it dries, and wear gloves because peroxide can irritate skin.
For larger or older stains, soak the shirt in hot water with powdered oxygen bleach for at least 8 hours, ideally overnight. Hot water helps activate the treatment, and a second soak may be needed for stubborn stains.
If the shirt is delicate, expensive, or already has severe discoloration, professional cleaning is the safest option. Some sweat damage is actually dye loss, and that cannot be washed out at home.
For most colored shirts, though, the combination of pre-treatment, oxygen bleach, and patience gives the best results.
Or ask about any laundry or garment care question