This feature of the visual system is called chromatic adaptation, or color constancy; when the correction occurs in a camera it is referred to as white balance.
Though the human visual system generally does maintain constant perceived color under different lighting, there are situations where the relative brightness of two different stimuli will appear reversed at different illuminance levels.
For example, the bright yellow petals of flowers will appear dark compared to the green leaves in dim light while the opposite is true during the day.
This is known as the Purkinje effect, and arises because the peak sensitivity of the human eye shifts toward the blue end of the spectrum at lower light levels.
The method is to apply a gain to each of the human cone cell spectral sensitivity responses so as to keep the adapted appearance of the reference white constant.
CIE L*a*b* (CIELAB) performs a "simple" von Kries-type transform in XYZ color space,[7] while CIELUV uses a Judd-type (translational) white point adaptation.