A photoelectrochromic cell results from combining a dye-sensitized sellar cell electrode with an electrochromic electrode. This produces a self-powered window that spontaneously darkens when illuminated by sunlight. The optical state can be stored at open circuit, or changed by varying the illumination at short circuit or by applying a voltage, The cells can function as purely photochromic devices, as electrochromic devices, or as a hybrid of the two. Photoelectrochromic cells may find application as self-powered smart windows in buildings and vehicles, optically addressable displays glare-control devices, and self-adjusting sunglasses and rear view mirrors.