PHP 클래스 ConsoleKit\Colors

Text can be colorized (foreground only) by using a static method named after the color code. $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');
파일 보기 프로젝트 열기: maximebf/consolekit 1 사용 예제들

공개 메소드들

메소드 설명
__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

비공개 메소드들

메소드 설명
extractColorAndOptions ( integer $colorCode ) : array Extracts the options and the color from a color code

메소드 상세

__callStatic() 공개 정적인 메소드

public static __callStatic ( $method, $args )

colorize() 공개 정적인 메소드

Returns a colorized string
public static colorize ( string $text, string $fgcolor = null, string $bgcolor = null ) : string
$text string
$fgcolor string (a key from the $foregroundColors array)
$bgcolor string (a key from the $backgroundColors array)
리턴 string

colorizeLines() 공개 정적인 메소드

Returns a text with each lines colorized independently
public static colorizeLines ( string $text, string $fgcolor = null, string $bgcolor = null ) : string
$text string
$fgcolor string
$bgcolor string
리턴 string

getBgColorString() 공개 정적인 메소드

Returns a background color string
public static getBgColorString ( $colorCode ) : string
리턴 string

getColorCode() 공개 정적인 메소드

$color can be a string with the color name, or one of the color constants.
public static getColorCode ( integer | string $color, array $options = [] ) : integer
$color integer | string
$options array
리턴 integer

getFgColorString() 공개 정적인 메소드

Returns a foreground color string
public static getFgColorString ( $colorCode ) : string
리턴 string