nostrudel has done something like that with a "public key color", generated deterministically from the public key, that can be used to distinguish users which otherwise have the same name/avatar
not sure this is the best solution as the eye can only distinguish so many colors, and ostensibly spammers could grind until they have a similar enough color (but currently don't), but it's something