Created
May 12, 2019 13:08
-
-
Save aiwas/0216d2915494a6fea4418785811a0b0c to your computer and use it in GitHub Desktop.
ターミナルで256色出すやつの再発明
This file contains hidden or 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
print_256_bg() { | |
for c in {000..015}; do | |
echo -n "\e[7m\e[38;5;${c}m $c \e[0m" | |
[ $(($c%8)) -eq 7 ] && echo | |
done | |
for c in {016..255}; do | |
echo -n "\e[7m\e[38;5;${c}m $c \e[0m" | |
[ $(($c%12)) -eq 3 ] && echo | |
done | |
} | |
print_256() { | |
for c in {000..015}; do | |
echo -n "\e[38;5;${c}m $c " | |
[ $(($c%8)) -eq 7 ] && echo | |
done | |
for c in {016..255}; do | |
echo -n "\e[38;5;${c}m $c " | |
[ $(($c%12)) -eq 3 ] && echo | |
done | |
} | |
print_256_test() { | |
echo "\e[48;5;${2}m\e[38;5;${1}m FG:${1} BG:${2} " | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment