Last active
March 21, 2019 20:20
-
-
Save hsiuhsiu/9843f31873a4cb28aa820c83cd82db3c to your computer and use it in GitHub Desktop.
print 256 colors in 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 | |
effs=(0 1 2 7 9) | |
effs2=(0 1 2 3 4 5 6 8) | |
for eff in "${effs[@]}" ; do | |
for i in {30..37} ; do | |
for j in {40..47} ; do | |
ansi_eff="${eff};${i};${j}m" | |
printf "\033[${ansi_eff} ${ansi_eff} \033[0m" | |
done | |
printf "\n" | |
done | |
printf "\n" | |
done | |
for eff in "${effs2[@]}" ; do | |
ansi_eff="${eff};37;40m" | |
printf "\033[${ansi_eff} ${ansi_eff} \033[0m" | |
done | |
printf "\n" | |
printf "\n" | |
for i in {0..255} ; do | |
printf "\x1b[38;5;%sm%5d\e[0m" "$i" "$i" | |
if (( ($i) %16 == 15 )); then | |
printf "\n"; | |
fi | |
done | |
printf "\n" | |
for i in {0..255} ; do | |
printf "\x1b[48;5;%sm%4d \e[0m" "$i" "$i" | |
if (( (i) % 16 == 15 )); then | |
printf "\n"; | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment