Last active
April 30, 2023 23:21
-
-
Save robertpeteuil/85795abae79b53aeece5b0e543acfa32 to your computer and use it in GitHub Desktop.
Bash Ansi Colors
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 | |
## Ansi Colors | |
N="$(printf '\033[')" x=30 | |
for a in Bl R G Y B M C W # 4-bit Black Red Green Yellow Blue Magenta Cyan White | |
do eval $a='$N'"'"$(( x))"m'" \ | |
b$a='$N'"'"$((60+x))"m'" \ | |
${a}bg='$N'"'"$((10+x))"m'" \ | |
b${a}bg='$N'"'"$((70+x))"m'" # bX=bright Xbg=background bXbg=brgt bgnd | |
x=$((x+1)) | |
done | |
N="${N}0m" | |
printf "$Y${Gbg}I am yellow on green.$N\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment