19 lines
490 B
PHP
Raw Normal View History

2013-10-02 15:22:31 +02:00
<?php
2014-04-14 15:02:53 +02:00
function ansi2html($string)
{
2013-10-02 15:22:31 +02:00
$dictionary = array(
2013-10-17 09:57:29 +02:00
'[30m' => '<span style="color:black">',
'[31m' => '<span style="color:red">',
'[32m' => '<span style="color:green">',
'[33m' => '<span style="color:yellow">',
2013-10-02 15:22:31 +02:00
'[34m' => '<span style="color:blue">',
2013-10-17 09:57:29 +02:00
'[35m' => '<span style="color:fuchsia">',
'[36m' => '<span style="color:aqua">',
'[37m' => '<span style="color:white">',
2013-10-02 15:22:31 +02:00
'[m' => '</span>',
);
return str_replace(array_keys($dictionary), $dictionary, $string);
}