PHP 클래스 think\console\output\formatter\Style

파일 보기 프로젝트 열기: top-think/framework 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string | null $foreground = null, string | null $background = null, array $options = [] ) 初始化输出的样式
apply ( string $text ) : string 应用样式到文字
setBackground ( string | null $color = null ) 设置背景色
setForeground ( string | null $color = null ) 设置字体颜色
setOption ( string $option ) 设置字体格式
setOptions ( array $options ) 批量设置字体格式
unsetOption ( string $option ) 重置字体格式

메소드 상세

__construct() 공개 메소드

初始化输出的样式
public __construct ( string | null $foreground = null, string | null $background = null, array $options = [] )
$foreground string | null 字体颜色
$background string | null 背景色
$options array 格式

apply() 공개 메소드

应用样式到文字
public apply ( string $text ) : string
$text string 文字
리턴 string

setBackground() 공개 메소드

设置背景色
public setBackground ( string | null $color = null )
$color string | null 颜色名

setForeground() 공개 메소드

设置字体颜色
public setForeground ( string | null $color = null )
$color string | null 颜色名

setOption() 공개 메소드

设置字体格式
public setOption ( string $option )
$option string 格式名

setOptions() 공개 메소드

批量设置字体格式
public setOptions ( array $options )
$options array

unsetOption() 공개 메소드

重置字体格式
public unsetOption ( string $option )
$option string 格式名