This patch series implements the system Dirkjan described. While it does add a new API function, I think it's clean and simple. An implementation of hg record colorization using the new API follows.