Disclosed are polymeric dyes obtained by the reaction of (a) a basic polycondensate with (b) an electrophilic dye of formula (2) P-X-Ya+ Ana- wherein the basic polycondensate (a) is obtained by the reaction of (a1) an amine of formula (I) in the presence of an anhydrous solvent with an ammonium salt (a2) with a cyanamide wherein R1, R2, R3 and R4 independently from each other are hydrogen or C1-C4alkyl, which may be substituted by amino, hydroxy, cyano or C1-C4alkoxy A is C2-C20alkylene, which may be substituted or interrupted by one or more than one hetero atoms P is a reactive grouping capable of reacting with a nitrogen nucleophile X is a linkage group selected from C1-C30alkylene, C2-C12alkenylene, C5-C10arylene, C5- C10cycloalkylene and C1-C10alkylene(C5-C10arylene) which may be interrupted and/or terminated at one or both ends by one or more than one -O-, -S-, -N=, -N(R5)-, -S(O)-, SO2, -(CH2CH2-O)1-5-, -(CH2CH2CH2-O)1-5-, -C(O)-, -C(O)O-, -OC(O)-, (II), -CON(R5)-, -C(NR5R6)2-, -(R5)NC(O)-, -C(S)R5- or an optionally substituted, saturated or unsaturated, fused or non-fused aromatic or nonaromatic (hetero)cyclic bivalent radical optionally comprising at least one heteroatom -O- -S- -N(R5)- -S(O)- -SO2- -(CH2CH2-O)1-5- -C(O)- -C(O)O-, -OC(O)- (III) -CON(R5)- -SO2N(R5)- -C(NR5R6)2- -(R5)NC(O)- -C(S)R5- saturated or unsaturated, fused or non-fused aromatic or nonaromatic bivalent radical optionally comprising at least one heteroatom which is optionally substituted by C1-C30alkyl, C1-C30alkoxy, C2-C12alkenyl, C5-C10aryl, C5-C10cycloalkyl, C1-C10alkyl(C5-C10arylene), halogen or hydroxy or the direct bond Y is a residue of an organic dye R5 and R6 independently from each other are hydrogen unsubstituted or substituted, straight-chain or branched, monocyclic or polycyclic, interrupted or uninterrupted d- C14alkyl C2-C14alkenyl C6-C10aryl C6-C10aryl-C1-C10alkyl or C5-C10alkyl(C5-C10aryl) a is 1, 2 or 3 and An is an anion. The dyes are distinguished by their depth of sh