renderColoredString() public static method
Converts a string to ansi formatted by replacing patterns like %y (for yellow) with ansi control codes
Uses almost the same syntax as https://github.com/pear/Console_Color2/blob/master/Console/Color2.php The conversion table is: ('bold' meaning 'light' on some terminals). It's almost the same conversion table irssi uses.
text text background ------------------------------------------------ %k %K %0 black dark grey black %r %R %1 red bold red red %g %G %2 green bold green green %y %Y %3 yellow bold yellow yellow %b %B %4 blue bold blue blue %m %M %5 magenta bold magenta magenta %p %P magenta (think: purple) %c %C %6 cyan bold cyan cyan %w %W %7 white bold white white %F Blinking, Flashing %U Underline %8 Reverse %_,%9 Bold %n Resets the color %% A single %First param is the string to convert, second is an optional flag if colors should be used. It defaults to true, if set to false, the color codes will just be removed (And %% will be transformed into %)
public static string renderColoredString ( $string, $colored = true ) | ||
---|---|---|
$string | string |
String to convert |
$colored | boolean |
Should the string be colored? |
Please login to continue.