发信人: seaboy (要从太阳上取金子的化学家), 信区: ANSI
标 题: ASCII入门教程(二)——关于颜色①
发信站: 日月光华 (2003年04月02日19:32:07 星期三), 站内信件
呵呵,说到颜色,我这里之谈技术不谈技巧,实在是本人技巧有限,所以只讲讲
如何显示出各种颜色。
颜色共分两种,一种是前景色,一种是背景色,下面分别举例介绍一下
1、前景色
暗色:格式为“*[0;3xm”其中0代表暗色的属性,3x表示31~37的各个值,
分别代表不同的颜色,其中的*号为按两下Esc键打出。举例如下:
*[0;30m 黑色 *[0;30;47m测试一下 ==> 测试一下
*[0;31m 红色 *[0;31m测试一下 ==> 测试一下
*[0;32m 绿色 *[0;32m测试一下 ==> 测试一下
*[0;33m 土棕色 *[0;33m测试一下 ==> 测试一下
*[0;34m 深蓝 *[0;34m测试一下 ==> 测试一下
*[0;35m 紫色 *[0;35m测试一下 ==> 测试一下
*[0;36m 浅蓝 *[0;36m测试一下 ==> 测试一下
*[0;37m 白色 *[0;37m测试一下 ==> 测试一下
亮色:格式为“*[1;3xm”其中1代表亮色的属性,3x表示31~37的各个值,
亮色:格式为“*[1;3xm”其中1代表亮色的属性,3x表示31~37的各个值,
分别代表不同的颜色,其中的*号为按两下Esc键打出。举例如下:
*[1;30m 深灰色 *[1;30m测试一下 ==> 测试一下
*[1;31m 亮红色 *[1;31m测试一下 ==> 测试一下
*[1;32m 亮绿色 *[1;32m测试一下 ==> 测试一下
*[1;33m 黄色 *[1;33m测试一下 ==> 测试一下
*[1;34m 亮深蓝 *[1;34m测试一下 ==> 测试一下
*[1;35m 亮紫色 *[1;35m测试一下 ==> 测试一下
*[1;36m 亮浅蓝 *[1;36m测试一下 ==> 测试一下
*[1;37m 亮白色 *[1;37m测试一下 ==> 测试一下
2、背景色
背景色与前景色稍有不同,它不分暗色亮色,所有背景色都是暗色,因此控制符
也比较简单,格式是“*[4xm”,其中4x代表从40~47的数值,不同数值所对应的
背景色也不同,此外格式中4xm后面可以加空格,空格可表示背景色的范围,结束
位置以*[m为标志,先以红色背景为例说明一下:
*[41m *[m ==>
↑↑ ↑↑
一二 一二
当然这其中的空格若以汉字或其他符号代替也可。下面列举一下各背景色的具体例子:
*[40m 黑色 *[m ==> 黑色
*[41m 红色 *[m ==> 红色
*[42m 绿色 *[m ==> 绿色
*[43m 棕色 *[m ==> 棕色
*[44m 深蓝 *[m ==> 深蓝
*[45m 紫色 *[m ==> 紫色
*[46m 浅蓝 *[m ==> 浅蓝
*[47m 白色 *[m ==> 白色
--
◢ ╭╮ ◆ │ ◣
ヽ ╰╮ │ ◤
◢ ┃╭┓╭╮┣╮╭┓┳╭ ◥
╯ ╰╯┣╯╰┻╰╯╰╯╰┫ ╰ ▼
◣ ◤ ╰╯ │ ◣
╰╯
※ 来源:·日月光华 bbs.fudan.edu.cn·[FROM: 10.100.107.130]
Sender: seaboy The chemist who wants to get gold from the sun, message area: ANSI
Title: ASCII introductory tutorial 2 About color ①
Sending site: Sun and Moon Guanghua Wednesday, April 2, 2003 19:32:07, site mail
Haha, speaking of color, I’m not going to talk about technique here. My skills are really limited, so I’m just going to talk about it.
How to display various colors
There are two types of colors, one is the foreground color and the other is the background color. Here are examples of each.
1 foreground color
The format of dark color is *[0;3xm, where 0 represents the attribute of dark color and 3x represents the values of 31 and 37.
They represent different colors. The * sign is typed by pressing the Esc key twice. Examples are as follows.
*[0;30m Black *[0;30;47m Test it > Test it
*[0;31m red *[0;31mTest it >Test it
*[0;32m Green *[0;32m Test it > Test it
*[0;33m Earthy brown *[0;33m Test it > Test it
*[0;34m Dark Blue *[0;34mTest it >Test it
*[0;35m Purple *[0;35m Test it > Test it
*[0;36m light blue *[0;36mTest it >Test it
*[0;37m white *[0;37mTest it >Test it
The format of bright color is *[1;3xm, 1 represents the attribute of bright color, 3x represents the values of 31 and 37
The format of bright color is *[1;3xm, 1 represents the attribute of bright color, 3x represents the values of 31 and 37
They represent different colors. The * sign is typed by pressing the Esc key twice. Examples are as follows.
*[1;30m dark gray *[1;30m test it > test it
*[1;31m bright red *[1;31m test it > test it
*[1;32m bright green *[1;32m test it > test it
*[1;33m yellow *[1;33mTest it >Test it
*[1;34m bright dark blue *[1;34m test it > test it
*[1;35m bright purple *[1;35m test it > test it
*[1;36m bright light blue *[1;36m test it > test it
*[1;37m bright white *[1;37m test it > test it
2 background color
The background color is slightly different from the foreground color. It does not distinguish between dark and bright colors. All background colors are dark, so the control symbol
It is also relatively simple. The format is *[4xm, where 4x represents the value from 40 to 47. Different values correspond to
The background color is also different. In addition, a space can be added after 4xm in the format. The space can indicate the range of the background color. End
The position is marked by *[m. Let’s take the red background as an example.
*[41m *[m >
one two one two
Of course, the spaces can also be replaced by Chinese characters or other symbols. Here are specific examples of each background color:
*[40m black *[m > black
*[41m red *[m > red
*[42m green *[m > green
*[43m brown *[m > brown
*[44m dark blue *[m > dark blue
*[45m purple *[m > purple
*[46m light blue *[m > light blue
*[47m white *[m > white
ヽ
Source: Sun and Moon Guanghua bbs.fudan.edu.cn [FROM: 10.100.107.130]