Stimuli-responsive fluorescence materials are crucial in developing intelligent materials and have wide applications in anti-counterfeiting and information encryption. However, organic fluorescence dyes with strong π-π intermolecular interactions and dense molecular packing lead to inertia ability of stimuli-responsive. Here, we design and synthesize spacer group modified naphthalimide compounds (P1 and P2) with acidichromism and mechanochromism properties. Photoinduced electron transfer (PET) between naphthalimide and trimethylamine moieties quenches fluorescence of P1 and P2. Then, fluorescence is obtained when P1 and P2 interact with hydrochloric acid (named P1-HCl and P2-HCl). More importantly, the spacer group modified P1-HCl with a highly twisted conformation, preventing strong intermolecular π-π interactions and a compact packing structure, contributing to obvious mechanochromism, while P2-HCl does not. Our study provides a molecular strategy to investigate the relationship between molecular chemical structure and stimuli-responsive fluorescence properties and realizes anti-counterfeiting applications.