Trapping of a carrier at an ionized impurity in porous silicon may be significantly hindered when the material is embedded in a high-dielectric-constant medium such as an aqueous electrolyte. This effect is estimated for a geometry of cylindrical silicon wires, and by modeling the two media with wavevector-independent dielectric constants. The self-image potential of the electron is taken into account, and the frequency dependence of the outer dielectric constant is treated in a simple manner. The results demonstrate that the impurity states are not accessible in the presence of the electrolyte, just due to the dielectric relaxation of the embedding medium. This result may apply to different kinds of localized electronic states, including those responsible for the red luminescence in dry porous silicon. This provides a plausible explanation for the red to green switching of the luminescence when the porous silicon is wet and suggests that using embedding media of intermediate dielectric constants should allow one to observe a progressive transition between red and green luminescence. Observation of porous silicon luminescence in solvents of various dielectric constants provides a preliminary test of this prediction