We study the optical and electrical properties of silver films with a graded thickness obtained through metallic evaporation in vacuum on a tilted substrate to evaluate their use as semitransparent electrical contacts. We measure their ellipsometric coefficients, optical transmissions and electrical conductivity for different widths, and we employ an efficient recursive method to calculate their macroscopic dielectric function, their optical properties and their microscopic electric fields. The topology of very thin films corresponds to disconnected islands, while very wide films are simply connected. For intermediate widths the film becomes semicontinuous, multiply connected, and its microscopic electric field develops hotspots at optical resonances which appear near the percolation threshold of the conducting phase, yielding large ohmic losses that increase the absorptance above that of a corresponding homogeneous film. Optimizing the thickness of the film to maximize its transmittance above the percolation threshold of the conductive phase we obtained a film with transmittance T = 0.41 and a sheet resistance Rsmax ≈ 2.7 Ω. We also analyze the observed emission frequency shift of porous silicon electroluminescent devices when Ag films are used as solid electrical contacts in replacement of electrolytic ones.