又一次读到关于Console Color的文章,决定把以前的积累合在一起贴出来。
今天看见这个: http://www.linuxjournal.com/article/8603
以前,还有些积累:
[ANSI颜色的表示]
可以参考color文件夹下的程序和两个网页文件。
[改变ls的颜色]
偶然发现了ls命令中目录的颜色和链接的颜色相同,都变成了浅蓝色。
在/etc/DIR_COLORS文件中对ls命令显示结果中不同类型的对象定义了颜色。
另外,在每个帐户$HOME目录下,还可以定义自己的 .dir_colors文件替代使用系统默认文件。
[RGB色彩]
在/usr/lib/X11/rgb.txt文件中有详细定义。运行xcolor命令显示颜色名称。
[字体]
通过xlsfonts命令查看全部字体。通过xfontsel选择字体。
#!/bin/bash
# Show all ANSI colors
#
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
esc="33["
echo -n " _ _ _ _40 _ _ _ 41_ _ _ _42 _ _ _ 43"
echo "_ _ _ 44_ _ _ _45 _ _ _ 46_ _ _ _47 _"
for fore in 30 31 32 33 34 35 36 37; do
line1="$fore "
line2=" "
line3=" "
line4=" "
for back in 40 41 42 43 44 45 46 47; do
line1="${line1}${esc}${back};${fore}m Normal ${esc}0m"
line2="${line2}${esc}${back};${fore};1m Bold ${esc}0m"
line3="${line3}${esc}${back};${fore};4m Unsc ${esc}0m"
line4="${line4}${esc}${back};${fore};5m Blnk ${esc}0m"
done
echo -e "$line1n$line2n$line3n$line4n"
done

2 条评论:
Hello from the Türkei
Saludos desde Chile.
发表评论