title: A library to convert ANSI escapes (terminal formatting/color codes) to HTML
body: <p>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:</p>
  
  <pre>ESC[00mESC[01;34mbinESC[00m
  ESC[01;34mcodeESC[00m
  ESC[01;31mdropbox-lnx.x86-0.6.404.tar.gzESC[00m
  ESC[00mfooESC[00m</pre>
  
  <p>Into this:</p>
  
  <pre><code>&lt;span style="color:blue"&gt;bin&lt;/span&gt;
  &lt;span style="color:blue"&gt;code&lt;/span&gt;
  &lt;span style="color:red"&gt;dropbox-lnx.x86-0.6.404.tar.gz&lt;/span&gt;
  foo
  </code></pre>
  
  <p>Converting breaks into &lt;br/&gt; 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.</p>
  
  <p>Does such a tool (command line linux) or library (perl, python, or ruby preferably) exist?</p>