The present invention relates to a composition for dyeing keratin fibers, comprising a) at least one oxidation dye precursor, b) at least one anionic associative polymer i), c) at least one anionic non associative polymer ii), and d) at least one anionic surfactant. The composition optionally contains alkaline agent.