change stdout with ANSI character set

homepage-banner

Use ANSI escape sequences to output customized terminal colors

# Configuration items related to color
# Set color
echo -e "\033[30m Black text \033[0m"
echo -e "\033[31m Red text \033[0m"
echo -e "\033[32m Green text \033[0m"
echo -e "\033[33m Yellow text \033[0m"
echo -e "\033[34m Blue text \033[0m"
echo -e "\033[35m Purple text \033[0m"
echo -e "\033[36m Cyan text \033[0m"
echo -e "\033[37m White text \033[0m"

# Set color and background color
echo -e "\033[40;37m Black background white text \033[0m"
echo -e "\033[41;37m Red background white text \033[0m"
echo -e "\033[42;37m Green background white text \033[0m"
echo -e "\033[43;37m Yellow background white text \033[0m"
echo -e "\033[44;37m Blue background white text \033[0m"
echo -e "\033[45;37m Purple background white text \033[0m"
echo -e "\033[46;37m Cyan background white text \033[0m"
echo -e "\033[47;30m White background black text \033[0m"

# More configuration items
\033[0m Turn off all attributes
\033[1m Set high brightness
\033[4m Underline
\033[5m Flashing
\033[7m Reverse display
\033[8m Concealment
\033[30m -- \033[37m Set foreground color
\033[40m -- \033[47m Set background color
\033[nA Move the cursor up n lines
\033[nB Move the cursor down n lines
\033[nC Move the cursor right n lines
\033[nD Move the cursor left n lines
\033[y;xHSet cursor position
\033[2J Clear screen
\033[K Clear the contents from the cursor to the end of the line
\033[s Save cursor position
\033[u Restore cursor position
\033[?25l Hide cursor
\033[?25h Show cursor
Feedback







Disclaimer
  • Welcome to visit the knowledge base of SRE and DevOps!
  • License under CC BY-NC 4.0
  • Made with Material for MkDocs and improve writing by generative AI tools
  • Copyright issue feedback me#imzye.com, replace # with @