Metallo- and ionochromic study of spiropyran as a multiresponsive sensor in liquid and solid state