PHP 클래스 Phrozn\Outputter\Console\Color

Anticipating update in code rather than in docs (fix is trivial and BC will be honored) this class serves as adapter until this moment comes.
저자: Victor Farazdagi
파일 보기 프로젝트 열기: farazdagi/phrozn 1 사용 예제들

공개 메소드들

메소드 설명
convert ( string $string, boolean $colored = true ) : string converts colorcodes in the format %y (for yellow) into ansi-control codes. the conversion table is: ('bold' meaning 'light' on some terminals). it's almost the same conversion table irssi uses.
escape ( string $string ) : string Escapes % so they don't get interpreted as color codes
getConsoleColorer ( ) : Console_Color Get instance of included Console_Color
getInstance ( ) : Color Get singleton instance
strip ( string $string ) : string Strips ANSI color codes from a string

비공개 메소드들

메소드 설명
__clone ( ) Singleton. Cloning is explicitly disallowed.
__construct ( ) : void Initialize Console_Color dependency

메소드 상세

convert() 공개 정적인 메소드

                 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 colorcodes will just be removed (and %% will be transformed into %)
public static convert ( string $string, boolean $colored = true ) : string
$string string string to convert
$colored boolean should the string be colored?
리턴 string

escape() 공개 정적인 메소드

Escapes % so they don't get interpreted as color codes
public static escape ( string $string ) : string
$string string String to escape
리턴 string

getConsoleColorer() 공개 메소드

Get instance of included Console_Color
public getConsoleColorer ( ) : Console_Color
리턴 Console_Color

getInstance() 공개 정적인 메소드

Get singleton instance
public static getInstance ( ) : Color
리턴 Color

strip() 공개 정적인 메소드

Strips ANSI color codes from a string
public static strip ( string $string ) : string
$string string String to strip
리턴 string