Created
August 28, 2023 16:54
-
-
Save nemoDreamer/e2ae7453cb25797e478c04b2b3b93214 to your computer and use it in GitHub Desktop.
Display ANSI palette 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
#!/usr/bin/env bash | |
NAMES=(Black Red Green Yellow Blue Magenta Cyan White) | |
CHAR="██ " | |
for i in {0..7}; do | |
CODE=$((i + 30)) | |
BRIGHT=$((i + 90)) | |
echo -n -e "${NAMES[$i]}\t" | |
# blocks | |
# - bright | |
echo -n -e "\033[${BRIGHT}m${CHAR}" | |
# - normal | |
echo -n -e "\033[${CODE}m${CHAR}" | |
# - faded | |
echo -n -e "\033[$CODE;2m${CHAR}" | |
# reset | |
echo -e "\033[0m\n" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment