发信人: comeonfulin (小猪呼噜噜), 信区: ASCIIArt
标 题: ASCIIArt短期培训班第三讲
发信站: 南京大学小百合站 (Thu Sep 8 20:16:24 2005)
ASCIIArt短期培训班第四讲
显示属性的设置
显示属性是BBS中比较常用的ANSI控制符,通常可以用来设置前景色(即文本颜
色)、背景色、高亮状态、文本下划线、闪烁文本和反显等。
下面首先介绍一下BBS中的常用颜色,一共可以设置16种不同的颜色,包括8种
低亮颜色和8种高亮颜色,如下所示(这与ANSIEditor的颜色工具栏相同):
■■■■■■■□ ← 低亮色
■■■■■■■■ ← 高亮色
为了避免其他方面造成的影响,请大家先把term软件的默认高亮设置关掉:
Cterm: 工具->系统参数设置->显示,选择正常显示(以低亮颜色为主)
Sterm: 选项->默认设置->外观,不要选则总是高亮
Fterm: 选项->参数设置,不要选则默认高亮
设置显示属性的代码为 *[p1;p2;...;pnm
其中*是ASCII控制符,在telnet编辑状态下连续按两次ESC键得到,注意不是
按shift+8得到的那个星号;p1...pn是整数,含义如下;m必须小写。
0-关闭各显示属性: *[m与*[0m类似,都能关闭闪烁、下划线和反显等属性的
显示,并恢复到默认前背景色。
1-高亮: *[1m可以得到相应的高亮颜色,*[1m*[31m和*[1;31m效果是一样的,
一般采用后者而使得代码更短。
4-下划线: *[4m可以给文本添加下划线,在Cterm里下划线一律是白色的,而
在Sterm或Fterm里面下划线的颜色与相应位置文字的颜色相同。
5-闪烁: *[5m可以给文本设置闪烁效果,一般来说一屏上闪烁的文本不要太
多太集中,这样会分散注意力。
7-反显: *[7m设置反显效果,建议不要使用,因为各种term软件对其解释差别
较大,Cterm中是交换前背景,高亮一律只作用在前景;Sterm中交换前背景,而且
会把高亮作用到背景色上,因此sterm中可能出现高亮背景低亮前景的情况;Fterm
中忽略前背景色,用白底黑字。
30~37-设置前景色: 40~47-设置背景色:
*[30m黑色 *[34m蓝色 *[40m暗黑 *[44m暗蓝
*[31m红色 *[35m紫色 *[41m暗红 *[45m暗紫
*[32m绿色 *[36m青色 *[42m暗绿 *[46m暗青
*[33m黄色 *[37m白色 *[43m暗黄 *[47m暗白
精简代码
一般来说BBS中一行代码的长度不超过254个英文字符,对于活动看板等有更严
格的限制,允许的代码长度更短,因此有时候一定要使用尽量短的代码,重复的代
码不要多次设置,例如:
高亮粉底白字高亮蓝底黄字闪烁红底黄字
正常情况下代码可以写成:
*[1;37;45m高亮粉底白字*[1;33;44m高亮蓝底黄字*[0;5;33;41m闪烁红底黄字
上面的代码可以精简为:
*[1;37;45m高亮粉底白字*[33;44m高亮蓝底黄字*[0;5;41m闪烁红底黄字
↑高亮状态不变 ↑前景色不变
需要注意的是,如果上述代码不使用*[m或*[0m关闭各显示属性,那么上一行
末尾的显示属性会延续到下一行,除非到达屏幕底端。
其他控制符介绍(选学)
以下一些ANSI控制符在制作超过6行的qmd、彩色id、彩色昵称以及右方垂直的
qmd时会用到,先列出来,有能力的学员可选学,在后边讲制作qmd时还会提到:
*[nA 光标上移n行 *[2J 清屏,并且光标移到屏幕左上角
*[nB 光标下移n行 *[K 清除从光标到行尾的内容
*[nC 光标右移n列 *[s 保存光标位置
*[nD 光标左移n列 *[u 恢复光标位置
*[y;xH 将光标移至第x列、第y行
telnet下编辑文章的特殊命令(选学)
ESC-C 观看彩色编辑成果 ESC-M 区块操作 ESC-G 跳转到指定行
ESC-F 设定前景色彩 ESC-D 删除区块 Ctrl+S 跳转至第一行
ESC-B 设定背景色彩 ESC-Q 清除标定 Ctrl+T 跳转至最后一行
ESC-R 还原色彩 Ctrl+U 标定区块
ESC-L 开或关讯息栏 Ctrl+C 复制区块
ESC-I 汇入档案 Ctrl+K 删至行末
ESC-E 汇出档案 Ctrl+Y 删除整行
Insert 切换插入/置换模式
其中黄色表示的命令比较常用,建议能够掌握。
作业
1. 熟记下面控制代码的意义:
*[0m、*[1m、*[4m、*[5m、*[7m、*[30m~*[37m、*[40m~*[47m
2. 写出上述每种控制代码的意义并附上效果,具体内容由学员自己安排,但
要包括上述所有的控制代码。请在telnet下term软件中直接写,不要在web下写,
也不要使用ANSIEditor编辑。编写时请注意代码的精简。写好后通过信件发给各自
指定的老师。
(附我在第一期培训班的作业,供大家参考:)
*[1;34;47m 高亮白底深蓝字 给大家看一首俺高中写的打油诗
*[4;5;30;41m 下划线闪烁红底黑字 瞌睡醒来无题一首
*[0;33;45m 粉底黄字 by comeonfulin
*[1;32;41m 高亮红底绿字 春天不是读书天,
*[1;31;46m 高亮天蓝底红字 夏日炎炎正好眠。
*[1;33;44m 高亮深蓝底黄字 秋有蚊虫冬怕冷,
*[1;37;45m 高亮粉底白字 收拾书包待明年。
最后搞一个反显的,ANSIEditor不是说轻易不要用反显么。
*[1;4;7m 高亮反显那就把ANSIEditor反显一下吧,哈哈
第五讲内容预告:ANSIEditor与各种term之间的复制粘贴
Sender: comeonfulin piggy snoring, message area: ASCIIArt
Title: Lecture 3 of ASCIIArt short-term training course
Sending station: Nanjing University Sayuri Station Thu Sep 8 20:16:24 2005
Lecture 4 of ASCIIArt short-term training course
Display property settings
The display attribute is a commonly used ANSI control character in BBS. It can usually be used to set the foreground color, that is, the text color.
Color, background color, highlight state, text underline, flashing text and reverse display, etc.
Let’s first introduce the commonly used colors in BBS. A total of 16 different colors can be set, including 8 colors.
Low light color and 8 highlight colors are shown below. This is the same as ANSIEditor's color toolbar:
low light color
Highlight color
In order to avoid other impacts, please turn off the default highlighting setting of the term software first.
Cterm: Tools>System Parameter Settings>Display Select normal display, mainly low-brightness colors
Sterm: Options>Default Settings>Appearance Uncheck to always highlight
Fterm: Options>Parameter settings If not selected, it will be highlighted by default.
The code to set the display attribute is *[p1;p2;...;pnm
Among them * is the ASCII control character. Press the ESC key twice in a row in the telnet editing state to get Note that it is not
The asterisk p1...pn obtained by pressing shift 8 is an integer, and its meaning is as follows. m must be lowercase
0 Turn off various display attributes: *[m is similar to *[0m. They can turn off attributes such as blinking, underlining and inverse display.
Display and restore to default background color
1 Highlight: *[1m can get the corresponding highlight color *[1m*[31m and *[1;31m have the same effect
Generally the latter is used to make the code shorter
4 Underline: *[4m can add underline to the text. In Cterm, the underline is always white.
The color of the underline in Sterm or Fterm is the same as the color of the text in the corresponding position.
5 Flashing: *[5m can set the flashing effect for the text. Generally speaking, the flashing text on the screen should not be too large.
Concentrating too much can distract you.
7 Reverse display: *[7m sets the reverse display effect. It is recommended not to use it because various term software interprets it differently.
Larger. In Cterm, the front and background are exchanged. Highlighting only applies to the foreground. In Sterm, the front and background are exchanged. And
The highlight will be applied to the background color, so there may be a situation where the background is highlighted and the foreground is low in Fterm.
Ignore the foreground and background color and use black text on a white background
30 37 Set foreground color: 40 47 Set background color:
*[30m black *[34m blue *[40m dark black *[44m dark blue
*[31m red *[35m purple *[41m dark red *[45m dark purple
*[32m green *[36m cyan *[42m dark green *[46m dark cyan
*[33m yellow *[37m white *[43m dark yellow *[47m dark white
Simplified code
Generally speaking, the length of a line of code in BBS should not exceed 254 English characters. For event billboards, etc., it is more strict.
The limitation of the format allows shorter code length, so sometimes it is necessary to use the shortest possible code. Repeated code
Do not set the code multiple times. For example:
Highlight foundation with white characters Highlighting blue with yellow characters Flashing red with yellow characters
Normally the code can be written as:
*[1;37;45mHighlight foundation with white text*[1;33;44mHighlight blue with yellow text*[0;5;33;41mFlashing red with yellow text
The above code can be simplified to
*[1;37;45mHighlight foundation with white text*[33;44mHighlight blue with yellow text*[0;5;41mFlashing red with yellow text
The highlight state remains unchanged and the foreground color remains unchanged.
It should be noted that if the above code does not use *[m or *[0m to turn off each display attribute, then the previous line
The display properties at the end will continue to the next line unless the bottom of the screen is reached.
Introduction to other control characters
The following ANSI control characters are used to create qmd with more than 6 lines, color ID, color nickname, and vertical ones on the right.
It will be used when making qmd. List it first. Students who are capable can choose to learn it. It will also be mentioned later when making qmd:
*[nA Move the cursor up n lines *[2J Clear the screen and move the cursor to the upper left corner of the screen
*[nB Move the cursor down n lines *[K Clear the content from the cursor to the end of the line
*[nC Move the cursor n columns to the right *[s Save the cursor position
*[nD Move the cursor n columns to the left *[u Restore the cursor position
*[y;xH Move the cursor to column x and row y
Special commands for editing articles under telnet Select a course
ESC C View color editing results ESC M Block operation ESC G Jump to the specified line
ESC F Set foreground color ESC D Delete block Ctrl S Jump to the first line
ESC B Set background color ESC Q Clear calibration Ctrl T Jump to the last line
ESC R Restore color Ctrl U Calibrate block
ESC L Open or close the message bar Ctrl C Copy block
ESC I Import file Ctrl K Delete to end of line
ESC E Export file Ctrl Y Delete entire line
Insert toggle insert replacement mode
Among them, the commands indicated in yellow are more commonly used. It is recommended to master them.
Operation
1. Memorize the meaning of the following control codes:
*[0m *[1m *[4m *[5m *[7m *[30m *[37m *[40m *[47m
2. Write the meaning of each control code mentioned above and attach the effect. The specific content is arranged by the students themselves. However,
To include all the above control codes, please write them directly in the term software under telnet and not under the web.
Do not use ANSIEditor to edit. Please pay attention to the simplification of the code when writing. After writing, send it to each of you via letter.
designated teacher
Attached is my homework from the first training class for your reference:
*[1;34;47m Highlight white background and dark blue characters. Let me show you a limerick I wrote in high school.
*[4;5;30;41m Underline flashing red background black text Untitled poem when you wake up from doze
*[0;33;45m foundation with yellow characters by comeonfulin
*[1;32;41m Highlight green text on red background Spring is not a day for reading
*[1;31;46m High-brightness red text on a sky blue background, perfect for sleeping in the hot summer
*[1;33;44m Highlight dark blue background with yellow characters. There are mosquitoes in autumn and are afraid of cold in winter.
*[1;37;45m Highlight foundation with white letters. Pack your schoolbag for next year.
Finally, make an ANSIEditor with reverse display. Didn’t you say that you shouldn’t use reverse display easily?
*[1;4;7m If the highlight is inverted, then use ANSIEditor to invert the highlight, haha
Preview of the fifth lecture: Copy and paste between ANSIEditor and various terms