Created
February 3, 2012 10:11
-
-
Save dekokun/1729491 to your computer and use it in GitHub Desktop.
PHPで標準出力の色やスタイルを変える
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$color = array( | |
'black' => 30, | |
'red' => 31, | |
'green' => 32, | |
'brown' => 33, | |
'blue' => 34, | |
'purple' => 35, | |
'cyan' => 36, | |
'grey' => 37, | |
'yellow' => 33 | |
); | |
$style = array( | |
'normal' => 0, | |
'bold' => 1, | |
'light' => 1, | |
'underscore' => 4, | |
'underline' => 4, | |
'blink' => 5, | |
'inverse' => 6, | |
'hidden' => 8, | |
'concealed' => 8 | |
); | |
$background = array( | |
'black' => 40, | |
'red' => 41, | |
'green' => 42, | |
'brown' => 43, | |
'yellow' => 43, | |
'blue' => 44, | |
'purple' => 45, | |
'cyan' => 46, | |
'grey' => 47 | |
); | |
print "\033[" . $color['red'] . "m"; | |
print "\033[" . $style['underscore'] . "m"; | |
print "\033[" . $background['blue'] . "m"; | |
print 'test'; | |
print "\033[" . $style['normal'] . "m"; | |
// thank you pear/Console_Color !!! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for pear/Console_Color !!!!!!
http://pear.php.net/package/Console_Color/redirected