首页 > 其他 > 详细

echo输出彩色文字

时间:2020-04-06 12:40:50      阅读:65      评论:0      收藏:0      [点我收藏+]

开启转义功能

echo -e表示开启转义功能,比如:
技术分享图片

彩色文字语法

echo -e "\e[前景;背景;特效m""hello""\e[0m",例如:
技术分享图片

console_codes

代码 含义
0 reset all attributes to their defaults
1 set bold
2 set half-bright
4 set underscore
5 set blink
7 set reverse video
10 reset selected mapping, display control flag, and toggle meta flag
11 select null mapping, set display control flag, reset toggle meta flag
12 select null mapping, set display control flag, set toggle meta flag
21 set normal intensity
22 set normal intensity
24 underline off
25 blink off
27 reverse video off
30 set black foreground
31 set red foreground
32 set green foreground
33 set brown foreground
34 set blue foreground
35 set magenta foreground
36 set cyan foreground
37 set white foreground
38 set underscore on, set default foreground color
39 set underscore off, set default foreground color
40 set black background
41 set red background
42 set green background
43 set brown background
44 set blue background
45 set magenta background
46 set cyan background
47 set white background
49 set default background color

echo输出彩色文字

原文:https://www.cnblogs.com/HachikoT/p/12641302.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!