I few years ago I managed to get ahold of a second hand Mindstorms NXT 2.0 set. Now the parts look fine, but all of the electronics were very yellowed!
You might've heard of retrobrighting, using hydrogen peroxide and sunlight (or sometimes heat) to make parts return to their original colour. Now it used to be the case that you'd need to submerge parts in the liquid, or smear them with paste. That obviously isn't a great idea for electronic components. You can't take apart those sensors easily, the NXT brick isn't that difficult, but try taking apart the other sensors without breaking them, good luck with that!
Cut to the chase!
So, after some experimenting and researching, the best technique seems to be having a sealed container with a small layer of hydrogen peroxide, in my case 35% (but that might be overkill), and setting it in the sun,
Upside down is a good idea for easy lifting without staining your hands (don't worry, that stuff'll come off after an hour or so)
The gas will build up and accelerate the retrobrighting process. You actually don't need hydrogen peroxide to retrobright, pure sunlight is enough, but that would take weeks, not hours.
This is a comparison of a before and after. The NXT brick looked the same as the sensor on the left.
It is good practise to take apart the NXT brick and to only put the white shell and the grey parts in the container.
For other parts it doesn't matter.
As you can see in these final results, the components are looking as good as new. And because I didn't need to take apart those motors, it even made the orange parts as vibrant as they should be!
This thread can serve as a future resource for people Googling like I was doing, and feel free to ask any question you have.