Linux Terminal Color Font output tutorial
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