For normal human observers, color is three-dimensional. The color appearance of any surface can be matched by adjusting just three variables (such as lightness, hue, and saturation). This trichromacy is mediated, but not ultimately explained, by the existence of three classes of photoreceptors -- retinal cones having peak sensitivities to longer, medium, and shorter wavelengths of visible light. Possibly, this trichromacy is the result of a more or less arbitrary compromise between (a) the larger number of dimensions required to represent the full spectral reflectance distributions of surfaces and (b) the smaller number of classes of retinal receptors needed to maintain, through denser retinal packing, higher spatial resolution for each receptor class. Alternatively, building on a linear model for color vision, as formulated by Maloney and Wandell, this paper seeks a less arbitrary basis for trichromacy in the prevailing degrees of freedom of terrestrial illumination. Natural selection may have favored trichromacy because it permits the achievement of color constancy despite terrestrial transformations of sunlight, which, unlike the variations in surface reflectances, have been limited to essentially three degrees of freedom. Any visual system, whether biological or artificial (including a system that requires merely an achromatic, shades-of-gray representation), can achieve constancy of color (and of lightness) only by first analyzing its optical input into three chromatic channels in order to compensate for the prevailing three degrees of freedom of terrestrial illumination.