The present disclosure relates to agents for dyeing keratin fibers, in particular human hair, containing, in a cosmetic carrier (a) at least one direct dye of formula (I), wherein Y1, Y2 independently represent a nitrogen atom or a group C—R9, and Q represents a special linker group of formula (II), (III), (IV) or (V), (b) at least one anionic surfactant and/or at least one cationic surfactant.