We consider representations of the fundamental groups of compact surfaces with boundary into classical simple Lie groups of Hermitian type. We relate work on the signature of the associated local systems, due to Meyer and Atiyah, to Burger-Iozzi-Wienhard's Toledo invariant. To measure the difference, we extend Atiyah-Patodi-Singer's rho invariant, initially defined on U(p), to discontinuous class functions, first on U(p,q), and then on other classical groups via embeddings into U(p,q). As an application, we obtain a Milnor-Wood type inequality which slightly differs from, and sometimes improves upon Burger-Iozzi-Wienhard's version. This is joint work with P. Pansu and X. Wan.