UNPKG

ansi_up

Version:

Convert ansi sequences in strings to colorful HTML

29 lines (23 loc) 688 B
<html> <head> <style type="text/css"> pre { margin: 0; font-family: monaco, "Courier New", Courier, monospace; line-height: 1.3; background: black; } </style> </head> <body> <pre id="console"></pre> </body> <script src="../ansi_up.js" type="text/javascript"></script> <script type="text/javascript"> var ansi_up = new AnsiUp; var txt = "\n\n\033[1;33;40m 33;40 \033[1;33;41m 33;41 \033[1;33;42m 33;42 \033[1;33;43m 33;43 \033[1;33;44m 33;44 \033[1;33;45m 33;45 \033[1;33;46m 33;46 \033[1m\033[0\n\n\033[1;33;42m >> Tests OK\n\n" var html = ansi_up.ansi_to_html(txt); var cdiv = document.getElementById("console"); cdiv.innerHTML = html; </script> </html>