There is a commercial product, the Puralytics solar water purifier made with a msh of titanium dioxide.
Depending on the intensity of the sunlight, it takes 2 to 4 hours for the blue color dye to disappear and indicate that the water is safe to drink.