1
RelativeLayout 2013-12-18 09:44:40 +08:00 1
|
2
Livid MOD OP |
3
Owenjia 2013-12-18 10:03:40 +08:00 1
直接输出 \[\033[前景色;背景色;控制代码m\] 这样的字符串就可以的~~
|
4
felix021 2013-12-18 10:04:04 +08:00 1
echo -e '\x1b[32mhello\x1b[0m'
|
5
dongsheng 2013-12-18 10:08:19 +08:00
把内容写在颜色和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
TankyWoo 2013-12-18 10:08:45 +08:00 1
|
7
lovesky 2013-12-18 10:18:12 +08:00
|
8
clino 2013-12-18 10:20:45 +08:00
|
9
Shieffan 2013-12-18 10:36:07 +08:00 via iPhone
colorama
|
10
Mutoo 2013-12-18 11:18:01 +08:00
之前看 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/ |
11
est 2013-12-18 12:19:48 +08:00
@Mutoo 其实Windows的cmd也可以加载ansi.sys之后就可以了。很sb的一个hack
http://blog.163.com/lovenet123@126/blog/static/35813760200994112242213/ |
12
ironblood 2013-12-18 13:23:54 +08:00
@Mutoo windows 下直接 telnet newsmth.net 就知道 win-cmd 能不能了。
|
13
dorentus 2013-12-18 14:10:07 +08:00
自己输出的话,用的就是上面大家提到的这个了:
http://en.wikipedia.org/wiki/ANSI_escape_code#Colors Google keyword: ANSI color |
14
dorentus 2013-12-18 14:11:48 +08:00
玩过当年各高校的命令行 BBS(比如楼上 iconblood 提到的 newsmth.net )的人应该都知道 :D
|