$text = Colors::colorize('hello world', Colors::RED)
$text = Colors::colorize('hello world', 'red')
$text = Colors::colorize('hello world', Colors::RED | Colors::BOLD)
$text = Colors::colorize('hello world', 'red+bold')
$text = Colors::red('hello world');
显示文件
Open project: maximebf/consolekit
Class Usage Examples
Method | Description | |
---|---|---|
__callStatic ( $method, $args ) | ||
colorize ( string $text, string $fgcolor = null, string $bgcolor = null ) : string | Returns a colorized string | |
colorizeLines ( string $text, string $fgcolor = null, string $bgcolor = null ) : string | Returns a text with each lines colorized independently | |
getBgColorString ( $colorCode ) : string | Returns a background color string | |
getColorCode ( integer | string $color, array $options = [] ) : integer | Returns a color code | |
getFgColorString ( $colorCode ) : string | Returns a foreground color string |
Method | Description | |
---|---|---|
extractColorAndOptions ( integer $colorCode ) : array | Extracts the options and the color from a color code |
public static getBgColorString ( $colorCode ) : string | ||
return | string |
public static getFgColorString ( $colorCode ) : string | ||
return | string |