Improving the luminescence properties of covalent organic frameworks (COFs) has always been an important issue. Here, a series of COFs (([OMe] x À TzDa (TzDa is composed only by monomerics Tz and Da, OMe represents the incorporation of monomeric Dm)) with different ratios of OMe and OH were designed and synthesized. The photochemical behavior of [OMe] x À TzDa changed significantly due to the synergistic effect of aggregation induced emission (AIE), intramolecular charge transfer (ICT), and excited-state intramolecular proton transfer (ESIPT) effects. [OMe] 2 À TzDa, which contained a ratio of 2/1 of OMe/OH, showed the strongest fluorescence emission in water and the best linear relationship for the detection of pH. Furthermore, [OMe] 2 À TzDa was used to monitor HCl and NH 3 gases and showed a color change, visible to the naked eye. Therefore, a "confidential pigment" was successfully made. Moreover, [OMe] 2 À TzDa was also applied to detect N 2 H 4 . The work indicates the [OMe] 2 À TzDa can serve as the first fluorescence sensor to detect pH, HCl and NH 3 gases, which also shows a good response to N 2 H 4 .