Yes, I've seen a bunch of shell and perl utilities that use this approach. You can't use them when you want 256 colors.
You can check http://cbouvi.free.fr/download/colorize/ and http://code.google.com/p/ansi-color/.
Ruby has highline and colored, and perhaps some more too.