Created
September 4, 2021 08:48
-
-
Save ppdouble/8d78645e0b01e69126f976a4ca5aa144 to your computer and use it in GitHub Desktop.
Shell 中输出带颜色的文本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 打印所有的颜色和颜色代码 | |
# 在 fedora 上 gnome-terminal 3.30.1 中已测试 | |
printf "\e\033[4;31m 浅 色\033[0m \t\t\033[1;4;31m 深 色\033[0m\n" | |
printf "\e[0;30;47m 黑 \e[0m 0;30m \t\e[1;30;40m 深 灰 \e[0m 1;30m\n" | |
printf "\e[0;31;47m 红 \e[0m 0;31m \t\e[1;31;40m 深 红 \e[0m 1;31m\n" | |
printf "\e[0;32;47m 绿 \e[0m 0;32m \t\e[1;32;40m 深 绿 \e[0m 1;32m\n" | |
printf "\e[0;33;47m 黄 \e[0m 0;33m \t\e[1;33;40m 亮 黄 \e[0m 1;33m\n" | |
printf "\e[0;34;47m 蓝 \e[0m 0;34m \t\e[1;34;40m 深 蓝 \e[0m 1;34m\n" | |
printf "\e[0;35;47m 紫红 \e[0m 0;35m \t\e[1;35;40m 暗紫红 \e[0m 1;35m\n" | |
printf "\e[0;36;47m 青 \e[0m 0;36m \t\e[1;36;40m 深 青 \e[0m 1;36m\n" | |
printf "\e[0;37;47m 浅 灰 \e[0m 0;37m \t\e[1;37;40m 白 \e[0m 1;37m\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment