A new asymmetrical diarylethene containing a 1H-imidazo [4,5-f][1,10] phenanthroline unit was synthesized. The compound showed typical photochromism and functioned as a notable fluorescence switch upon alternating irradiation with ultraviolet (UV) and visible light. Its closed-ring isomer could be used as a selective 'naked-eye' colorimetric sensor for Cu(2+), accompanied by a notable color change from blue to colorless. Furthermore, the compound was found to be selective towards Ca(2+), Mg(2+), and Sr(2+) with significant fluorescence changes. On the basis of this characteristic, a logic circuit was constructed by utilizing both light and chemical stimuli as inputs and fluorescence intensity at 487 nm as output.