  This paper deals with the 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 of
Atiyah-Patodi-Singer, to Burger-Iozzi-Wienhard's Toledo invariant. To measure
the difference, we extend Atiyah-Patodi-Singer's rho invariant, initially
defined on $\mathrm{U}(p)$, to discontinuous class functions, first on
$\mathrm{U}(p,q)$, and then on other classical groups via embeddings into
$\mathrm{U}(p,q)$. In this way, we present three different invariants --
signature, Toledo and rho invariant -- in a unifying way, which is a version of
the classical signature formula of Atiyah-Patodi-Singer for manifolds with
boundary.
