发信人: ANSIeditor (走自己的路), 信区: ASCIIArt
标 题: ASCIIArt短期培训班第四讲
发信站: 南京大学小百合站 (Fri Oct 29 14:23:39 2004)
ASCIIArt短期培训班第四讲
今天来讲些基本的Ascii控制码,熟记些Ascii控制码是非常有用的。
先讲讲颜色
BBS上我们可以设置的颜色共有16种,其中8种低亮颜色,8种高亮颜色,
■■■■■■■□ ← 低亮色
■■■■■■■■ ← 高亮色
为了避免其他方面造成的影响,请大家先把终端软件的默认高亮等的设置关掉:
·Cterm:工具>>选项>>显示>>普通文字,确认没选上强制高亮显示;
·Fterm:选项>>参数设置,确认没有选上默认高亮;
·Sterm:选项>>当前连接设置>>远程登录设置>>外观,确认没选上总是高亮。
设置显示属性
*[p1;p2;...;pnm
*是Ascii控制符,编辑状态下连续按两下Esc即可得到,
p1...pn是一些整数,含义见下,m必须小写。
0–关闭各显示属性 30~37 设置前景色
1–高亮 40~47 设置背景色
4–下划线
5–闪烁 *[m与*[0m类似 都能关闭闪烁、下划线和反显,
7–反显 并恢复到默认前背景色。
*[1m是设置高亮色
*[1m*[31m与*[1;31m是一样的,一般后者使得代码更短。
*[4m是添加下划线
在cterm里面下划线一律是白色的,
而fterm或sterm里面下划线的颜色与相应位置文字的颜色相同。
*[5m是闪烁
注意一般一屏上的闪烁不要过多或过于集中。
*[7m是反显
建议不要使用,各种term对反显的解释差别大,会使作品产生不同效果。
精简代码
一般来说BBS里面一行代码的长度最多254个字符(一个中文字算两个字符),
对于活动看板等,有更严格的限制,允许的代码长度更短,因此有时候一定要
使用尽量短的代码,重复的代码不要多次设置,例如:
白底黄字高亮红底黄字高亮闪烁绿底白字
*[0;33;47m白底黄字*[1;33;41m高亮红底黄字*[1;5;37;42m高亮闪烁绿底白字
上面的代码可以缩短为:
*[0;33;47m白底黄字*[1;41m高亮红底黄字*[5;37;42m高亮闪烁绿底白字
↑前景色不变 ↑高亮状态不变
注意:除非到达屏幕底端,否则上一行末尾的显示属性会延续到下一行。
光标控制
*[nA 光标上移n行
*[nB 光标下移n行 ┏━━━━━━━━┓
*[nC 光标右移n列 ┃本页中的白色字所┃
*[nD 光标左移n列 ┃写内容为选读内容┃
*[y;xH 将光标移至第x列、第y行 ┗━━━━━━━━┛
*[2J 清屏
*[K 清除从光标到行尾的内容
*[s 保存光标位置
*[u 恢复光标位置
特殊命令(请先按 ESC, 再选择以下项目)
(I)汇入档案 (E)汇出档案 (C)观看彩色编辑成果
(B)设定背景色彩 (F)设定前景色彩 (R)还原色彩
(ESC)彩色控制码 (M)区块处理 (L)开或关讯息栏
删除命令
Insert 切换插入/置换模式 Ctrl+K 删至行末 Ctrl+Y 删除一行
本节作业
熟记下面控制代码的意义
*[0m *[1m *[4m *[5m *[7m *[30m ~*[37m *[40m ~*[47m
将上述每种控制代码的意义写出,并附上效果,例:
*[1;32m 亮绿色 *[1;32m小帕 ==> 小帕
具体内容可随意安排,但要包括上述每种控制码,在term中直接写,
并注意代码的精简。请各位学员在11月1日21时前用信件形式
寄给各组指定老师。
ANSIeditor@lily
下节预告
基本知识终于介绍完了,接下来将讲述ASCIIArt的应用。
Sender: ANSIeditor go your own way, message area: ASCIIArt
Title: Lecture 4 of ASCIIArt short-term training course
Sending station: Nanjing University Sayuri Station Fri Oct 29 14:23:39 2004
Lecture 4 of ASCIIArt short-term training course
Today we will talk about some basic scii control codes. Memorizing some scii control codes is very useful.
Let’s talk about color first
There are 16 colors that we can set, including 8 low-brightness colors and 8 high-brightness colors.
low light color
Highlight color
In order to avoid the impact caused by other aspects, please turn off the default highlighting and other settings of the terminal software first.
Term Tools>>Options>>Display>>Normal text Make sure Force Highlighting is not selected
Term Options>>Parameter Settings Make sure default highlighting is not selected
Term options>>Current connection settings>>Remote login settings>>Appearance Confirm that it is always highlighted if it is not selected
Set display properties
*[p1;p2;...;pnm
* is the Ascii control character, which can be obtained by pressing sc twice in editing mode.
p1...pn are some integers. The meaning is as follows. m must be lowercase.
0 Close each display attribute 30 37 Set the foreground color
1 Highlight 40 47 Set background color
4 underline
5 Flashing *[m is similar to *[0m. Both of them can turn off flashing, underline and reverse display.
7 Invert the display and return to the default background color
*[1m is to set the highlight color
*[1m*[31m is the same as *[1;31m. Generally, the latter makes the code shorter.
*[4m is to add underline
In cterm, the underline is always white.
The color of the underline in fterm or sterm is the same as the color of the text in the corresponding position.
*[5m is flashing
Be careful not to have too many or too concentrated flickers on one screen.
*[7m is reverse display
It is recommended not to use it. Various terms have very different interpretations of reverse display, which will produce different effects in the work.
Simplified code
Generally speaking, the length of a line of code in BBS can be up to 254 characters, and one Chinese character counts as two characters.
There are stricter restrictions on activity boards, etc. The allowed code length is shorter, so sometimes it must
Use as short a code as possible. Do not set repeated code multiple times. For example
Highlight yellow characters on a white background Highlight yellow characters on a red background Flashing white characters on a green background
*[0;33;47mYellow characters on white background*[1;33;41mHighlight yellow characters on red background*[1;5;37;42mHighlight flashing white characters on green background
The above code can be shortened to
*[0;33;47mYellow characters on white background*[1;41mHighlight yellow characters on red background*[5;37;42mHighlight flashing white characters on green background
The foreground color remains unchanged and the highlight state remains unchanged.
Note that the display properties at the end of the previous line will continue to the next line unless the bottom of the screen is reached.
Cursor control
*[nA Move the cursor up n lines
*[nB Move cursor down n lines
*[nC Move the cursor n columns to the right. The white characters on this page are
*[nD Move the cursor n columns to the left and the written content is the selected reading content
*[y;xH Move the cursor to column x and row y
*[2J Clear screen
*[K clears the contents from the cursor to the end of the line
*[s save cursor position
*[u restore cursor position
Special command Please press ESC first, then select the following items
I Import file E Export file C View color editing results
B Set background color F Set foreground color R Restore color
ESC color control code M block processing L open or close message bar
Delete command
Insert switches to insert replacement mode Ctrl K deletes to the end of the line Ctrl Y deletes a line
Homework for this section
Memorize the meaning of the following control codes
*[0m *[1m *[4m *[5m *[7m *[30m *[37m *[40m *[47m
Write down the meaning of each of the above control codes and attach examples of their effects.
*[1;32m bright green *[1;32m small handkerchief small handkerchief
The specific content can be arranged at will, but each control code mentioned above must be included and written directly in the term.
And pay attention to the simplification of the code. Please send a letter by month and day.
Send to designated teachers of each group
ANSIeditor@lily
Next episode preview
The basic knowledge has finally been introduced. Next, we will talk about the application of ASCIIArt.