Last active
January 13, 2025 12:41
-
-
Save nerun/9057fc2de347e3e59f9a5eb4d6af6b97 to your computer and use it in GitHub Desktop.
A demonstration on how to add colors and text effects to bash terminal.
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 | |
clear | |
space=" " | |
echo -e "\e[93;45;1m $space A COLORFUL DEMO $space\e[0m" | |
echo -e "Basic usage: \e[47;90mecho -e \"\e[91;1m\\\e[COLORm\e[90;22mTEXT\e[91;1m\\\e[0m\e[90;22m\"\e[0m.\n" | |
echo -e "Where \"echo -e\" enable interpretation of backslash escapes. You can combine | |
multiple effects by separating them with semicolons:" | |
echo -e " \e[47;90m\\\e[COLOR;COLOR;EFFECT;ETCm\e[0mTEXT\e[47;90m\\\e[0m\e[0m\n" | |
echo -e "( 1) \e[1mBOLD\e[0m ( 5) \e[5mBLINKING\e[0m" | |
echo -e "( 2) \e[2mFADE\e[0m ( 9) \e[9mSTRIKETHROUGH\e[0m" | |
echo -e "( 3) \e[3mITALIC\e[0m (21) \e[21mDOUBLE UNDERLINE\e[0m" | |
echo -e "( 4) \e[4mUNDERLINE\e[0m\n" | |
C=0 | |
while [ $C -lt 8 ]; do | |
echo -ne "\e[3${C}mFOREGROUND (3${C}) \e[0m" | |
echo -ne "-\e[9${C}m BRIGHT FOREGROUND (9${C}) \e[0m" | |
echo -e "-\e[4${C}m BACKGROUND (4${C}) \e[0m" | |
let C=C+1 | |
done | |
echo -e "\e[97;45m$space $space\e[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment