Most wavelengths change hue when mixed with white light. These changes, known as the Abney effect, have been extensively studied to characterize nonlinearities in the neural coding of color, but their potential function remains obscure. We measured the Abney effect in a new way--by varying the bandwidth of the spectrum rather than mixing with white--and this leads to a new interpretation of the role of nonlinear responses in color appearance. Because of the eye's limited spectral sensitivity, increasing the bandwidth of a spectrum changes the relative responses in the three classes of cone receptor and thus would change hue if the percept were tied to a fixed cone ratio. However, we found that hue is largely independent of bandwidth and thus constant for a constant peak wavelength for stimuli with Gaussian spectra. This suggests that color appearance is compensated for the eye's spectral filtering, and that this compensation embodies specific perceptual inferences about how natural spectra vary. When a wavelength is instead diluted with white light--which does not bias the cone ratios--then the same compensation predicts changes in hue because the "right" response is made to the "wrong" stimulus. This model generates constant hue loci that are qualitatively consistent with measures of the Abney effect and provides a novel functional account of such effects in color appearance, in which postreceptoral responses are adjusted so that constant hue percepts are tied to consistent physical properties of the environment rather than consistent physiological properties such as the cone ratios.