Here are some unit tests for a colorizer that implements io.Writer:
http://play.golang.org/p/PyGDgJqtsE

The test cases might need to be tweaked, but hopefully it's close.