Well, black plastic is rated for as much voltage as anything. (In fact it's mostly silica fume, apparently earning a CTI category I rating, hence the minimal clearance on, for example, 1500V rated TO-220s. And also hence the minimal expansion, allowing them to be soldered without failure, despite going over the glass transition temperature of the resin used.)
The white ones just have slightly higher CTR. I suppose the opto capsule could just as well be layered with a white shell, then embedded in a regular black plastic package for the best of both worlds.
Optos BTW are usually made with, something like a silicone blob lens, between the emitter and detector, I think also with an explicit barrier such as a thin sheet of glass. Of course it's not actually a lens because there's no air around it, or anything else of different refractive index (and useful shape); it's just that something has to fill space else the resin will. So, with poor collimation, you would expect white resin to do better, though apparently not by much so it's neat that it performs as well as it does without much of a lens in there.
I've seen plenty of ICs in colors, but all of them old types (~70s?).
Heh which, I think one of them I remember was a buff or cream-colored 7404 made in the 6th week of 1974... or maybe it was a 7406 made in the 4th.

PNP transistors you sometimes see in green, for whatever reason.
I think I've seen some blue thyristors, though checking, I only have gray and black ones in my bin.
Tim