Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux Terminal Color Font output tutorial

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article teaches you how to set up a Linux terminal to output colored fonts. Usage\ 033 [display mode; foreground color Background color m display mode 0 (default), 1 (highlight), 22 (not bold), 4 (underline), 24 (non-underline), 5 (flashing), 25 (non-flashing), 7 (reflection), 27 (non-reflection) foreground color 30 (black), 31 (red), 32 (green), 33 (yellow), 34 (blue), 35 (magenta), 36 (cyan), 37 (white) background color 40 (black), 37 (white) 41 (red), 42 (green), 43 (yellow), 44 (blue), 45 (magenta), 46 (cyan), 47 (white) control codes

The control character opens a certain style, and when the output is complete, you need to close the style to restore the terminal to its original state:

Printf ("\ e [32m% s\ e [0m\ n", "hello world") \ 033 [0m turn off all attributes\ 033 [1m set high brightness\ 033 [4m underline\ 033 [5m flicker\ 033 [7m reverse display\ 033 [8m blanking] \ 033 [37m set foreground color\ 033 [40m UV color -\ 33 [47m set background color display sample echo-e "\ 033 [1 31TX 42mHelloworld\ 033 [0m "

The original text is from: https://www.linuxprobe.com/linux-color.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report