I'm looking for a code library that converts ANSI escape sequences into HTML color, via plain tags or CSS. For example, something that would convert this:
ESC[00mESC[01;34mbinESC[00m ESC[01;34mcodeESC[00m ESC[01;31mdropbox-lnx.x86-0.6.404.tar.gzESC[00m ESC[00mfooESC[00m
Into this:
<span style="color:blue">bin</span>
<span style="color:blue">code</span>
<span style="color:red">dropbox-lnx.x86-0.6.404.tar.gz</span>
foo
Converting breaks into <br/> isn't necessary, it's just the escape codes that I don't know. I could hack it together myself, but I'd probably miss something important like underlines or mess up how background colors work. I'd rather just sit on top of someone else's code.
Does such a tool (command line linux) or library (perl, python, or ruby preferably) exist?