|
1
|
|
2
|
|
3
直接输出 \[\033[前景色;背景色;控制代码m\] 这样的字符串就可以的~~
|
|
4
echo -e '\x1b[32mhello\x1b[0m'
|
|
dongshengDec 18, 2013
5
把内容写在颜色和Reset之间就行了。
Default = '\033[0m' Black = '\033[30m' Red = '\033[31m' Green = '\033[32m' Yellow = '\033[33m' Blue = '\033[34m' Magenta = '\033[35m' Cyan = '\033[36m' White = '\033[37m' Bold = '\033[1m' Reverse = '\033[2m' Blackbg = '\033[40m' Redbg = '\033[41m' Greenbg = '\033[42m' Yellowbg = '\033[43m' Bluebg = '\033[44m' Magentabg = '\033[45m' Cyanbg = '\033[46m' Whitebg = '\033[47m' Reset = '\033[0;0m' |
|
6
|
|
loveskyDec 18, 2013
7
|
|
ShieffanDec 18, 2013 via iPhone
9
colorama
|
|
MutooDec 18, 2013
10
之前看 lua 简明教程的时候有看到过一个例子,后来去查了,这东西叫 Terminal control-codes
> Terminal (control-)codes are needed to give specific commands to your terminal. This can be related to switching colors or positioning the cursor, simply everything that can’t be done by the application itself. 不只是变换颜色,还能移动光标,清屏等各种操作。貌似只在 *nix 有效,windows无能。 http://old.mutoo.im/2013/02/lua-io-write-272j/ |
|
estDec 18, 2013
11
@Mutoo 其实Windows的cmd也可以加载ansi.sys之后就可以了。很sb的一个hack
http://blog.163.com/lovenet123@126/blog/static/35813760200994112242213/ |
|
ironbloodDec 18, 2013
12
@Mutoo windows 下直接 telnet newsmth.net 就知道 win-cmd 能不能了。
|
|
dorentusDec 18, 2013
13
自己输出的话,用的就是上面大家提到的这个了:
http://en.wikipedia.org/wiki/ANSI_escape_code#Colors Google keyword: ANSI color |
|
dorentusDec 18, 2013
14
玩过当年各高校的命令行 BBS(比如楼上 iconblood 提到的 newsmth.net )的人应该都知道 :D
|