it would make sense for front/rear lens caps and body caps to be made transparent.
I think the main reason is probably that clear plastics like ABS tend to crack and turn yellow with exposure to UV light, whereas black versions are UV resistant. Experience seems to bear this out: I have some lenses from the early 70's that have original caps, and they're still in fine condition. But I've seen other items made of clear or smoky acrylic or polycarbonate that aren't nearly as old and which definitely show signs of aging.
Other likely reasons include price (black plastics may be cheaper than clear) and aesthetics (black matches most cameras and lenses).
Still, it's an interesting idea that's worth exploring. A lens cap would be an easy 3D printing project. It's easy to find existing models (here, here, here, etc.) that you can download and print, and clear ABS filament is available.
Unless you have a number of lenses that already have a fungus problem, it might be hard to know if clear caps really make much difference. You'd have to take extra steps (leave your lenses exposed to light, remove any UV filters), and the absence of fungus might just mean that you do a good job keeping your lenses dry.