Pyrene-based dual-mode fluorescence switches and logic gates that function in solution and film.