Fabrics can be dyed or printed on. If you have a fabric that is lighter on one side than the other, it was printed. If the design doesn't show at all, or only faintly, and is slightly raised on the front, it was probably silk-screened or was a heat-applied image. If the color is the same on both sides, it was probably dyed. Dyeing can be done at different times in the cycle of production. The raw fiber can be dyed before the yarn for the fabric is spun - if your fabric is flecked or heathery looking (like some men's grey t-shirt), then it was probably dyed in this fiber stage. Often, the yarn is first spun and then dyed before the fabric is made. This is the case for plaids and checkered fabrics. Some fabrics are woven from undyed yarns and then dyed. And finally, you will sometimes find garments that are first sewn and then dyed (think tye-dyed t-shirts, acid-washed jeans). So there are a lot of different ways to get that t-shirt purple...
Oh, and there are different types of dyes and inks. For cotton, the preferred low impact dyes are fiber reactive dyes, which chemically bond the colors to the fiber so they don't bleed or wash out. There are also disperse dyes, universal dyes, and all manner of textile inks, some of which has plastics in them, but inks are rarely used to create a solid colored fabric.
Does that help?