Recently I have been playing around with the Code Igniter PHP MVC framework and was hacking together a command line version to run an MVC style application from the terminal.

One of the things I did for this was to create a library that could be used by a view to colour text in a bash terminal.

This was done by taking the code found here and wrapping it up in a CI library.