@noah is correct but I want to add:
UV in sunlight can actually kill the top layer of mold and mold spores. But it won't do much to established mold. Having a dark colored bottle will actually increase the chances of mold developing because you're blocking UV.
Bottles are darker colored in industries like pharmaceutical and cosmetics to block UV rays which will break down vitamins and cause or speed up other unintended chemical reactions. In these industries various things are done to reduce the amount of mold like using very clean water and manufacturing processes and introducing additives.
"[C]ontainers in amber, cobalt blue and vintage green offer UV protection for beauty, food and beverage products with sensitivity to light. Each of these colors provides differing levels of UV protection: Amber, high; Cobalt, medium; and, Green, minimal." glass now
"The range of 200 to 280 nm UV light spectrum (UV-C) has a germicidal effect on microorganisms, including bacteria, yeasts, molds, and viruses. Microbial inactivation in liquid foods by UV-C depends on optical and flow properties of the product..." science direct
"UV light killed microbes growing in the cooling systems, causing a 99 percent reduction in the concentrations of bacteria, fungi and endotoxins, which are irritants produced by mold" Sick Building Syndrome fixed with UV
"Mold is caused by lingering moisture in dark place... check areas that are hidden, damp and dark because sunlight is the best anti-mold too." mold remediation