A dye is a color
Color or colour is the visual perceptual property corresponding in humans to the categories called red, green, blue and others. Color derives from the spectrum of light interacting in the eye with the spectral sensitivities of the light receptors...

ed substance that has an affinity
Chemical affinity
In chemical physics and physical chemistry, chemical affinity is the electronic property by which dissimilar chemical species are capable of forming chemical compounds...

 to the substrate to which it is being applied. The dye is generally applied in an aqueous solution
Aqueous solution
An aqueous solution is a solution in which the solvent is water. It is usually shown in chemical equations by appending aq to the relevant formula, such as NaCl. The word aqueous means pertaining to, related to, similar to, or dissolved in water...

, and requires a mordant
A mordant is a substance used to set dyes on fabrics or tissue sections by forming a coordination complex with the dye which then attaches to the fabric or tissue. It may be used for dyeing fabrics, or for intensifying stains in cell or tissue preparations. The term mordant comes from the Latin...

 to improve the fastness of the dye on the fiber.

Both dyes and pigments appear to be colored because they absorb some wavelengths of light
Light or visible light is electromagnetic radiation that is visible to the human eye, and is responsible for the sense of sight. Visible light has wavelength in a range from about 380 nanometres to about 740 nm, with a frequency range of about 405 THz to 790 THz...

 more than others. In contrast with a dye, a pigment
A pigment is a material that changes the color of reflected or transmitted light as the result of wavelength-selective absorption. This physical process differs from fluorescence, phosphorescence, and other forms of luminescence, in which a material emits light.Many materials selectively absorb...

 generally is insoluble, and has no affinity for the substrate.