Extensive use of quantum chemical calculations has been made to rationally design a molecule whose spin state can be switched reversibly using light of two different wavelengths at room temperature in solution. Spin change is induced by changing the coordination number of a nickel complex. The coordination number in turn is switched using a photochromic ligand that binds in one configuration and dissociates in the other. We demonstrate that successful design relies on a precise geometry fit and delicate electronic tuning. Our designer complex exhibits an extremely high long-term switching stability (more than 20 000 cycles) and a high switching efficiency. The high-spin state is extraordinarily stable with a half-life of 400 days at room temperature. Switching between the dia- and paramagnetic state is achieved with visible light (500 and 430 nm). The compound can also be used as a molecular logic gate with light and pH as input and the magnetic state as non-destructive read-out.