Git-Center/utils.php

19 lines
490 B
PHP
Raw Permalink Normal View History

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