You raise an interesting point. The Doppler effect does indeed exist for light, just as it does for sound. However, you are correct that the speed of light is constant in all reference frames according to the theory of special relativity. So, how does the Doppler effect apply to light?
The key to understanding this lies in the concept of frequency and wavelength. While the speed of light remains constant, the frequency and wavelength of light can change relative to an observer due to their relative motion. This is known as the relativistic Doppler effect or the Doppler shift.
When a light source and an observer are in relative motion, there can be a shift in the frequency and wavelength of the light observed by the observer. If the source of light is moving towards the observer, the observed frequency will be higher than the emitted frequency, resulting in a "blue shift" where the light appears shifted towards the blue end of the electromagnetic spectrum. On the other hand, if the source of light is moving away from the observer, the observed frequency will be lower than the emitted frequency, resulting in a "red shift" where the light appears shifted towards the red end of the spectrum.
This phenomenon is similar to the Doppler effect for sound, where the perceived frequency of a sound wave changes depending on the relative motion of the source and the observer. However, in the case of light, it is the frequency and wavelength that experience a shift rather than the speed of light itself.
It's important to note that the relativistic Doppler effect becomes more pronounced at high speeds, approaching the speed of light. At everyday velocities, such as those encountered on Earth, the Doppler shift for light is typically negligible and not easily noticeable. However, it becomes significant in scenarios involving astronomical observations, such as measuring the motion of celestial objects or studying the expansion of the universe.