Abstract Two novel asymmetrical diarylethenes with an imidazole-containing substituent have been synthesized. The two diarylethenes exhibited favorable photochromism and functioned as fluorescence switches upon alternating ultraviolet and visible light irradiation. These two compounds could also serve as highly selective ‘naked-eyes’ colorimetric sensors for Cu2+. Furthermore, the diarylethene with a 1H-phenanthro[9,10-d]imidazole unit was selective toward Sn2+, Al3+, and Cr3+ with remarkable fluorescence changes. Based on this characteristic, a logic circuit was constructed by utilizing the combinational stimuli of chemicals and light as the inputs and fluorescence intensity at 444 nm as the output.