Created
August 16, 2011 22:38
-
-
Save miku/1150364 to your computer and use it in GitHub Desktop.
Show an index of all available bash colors (OS X version)
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
color_index() { | |
# Show an index of all available bash colors | |
# Adapted from http://madebynathan.com/2011/08/16/bash-color-index/ | |
echo -e "\n Usage: \\\033[*;**(;**)m" | |
echo -e " Default: \\\033[0m\n" | |
# Top border | |
echo -e " \033[0;30;40m \033[0m" | |
for STYLE in 2 0 1 4 9; do | |
echo -en " \033[0;30;40m " | |
# Display black fg on white bg | |
echo -en "\033[${STYLE};30;47m${STYLE};30\033[0;30;40m " | |
for FG in $(jot - 31 37); do | |
CTRL="\033[${STYLE};${FG};40m" | |
echo -en "${CTRL}" | |
echo -en "${STYLE};${FG}\033[0;30;40m " | |
done | |
echo -e "\033[0m\n \033[0;30;40m \033[0m" | |
done | |
echo -en " \033[0;30;40m " | |
# Background colors | |
echo -en "\033[0;37;40m*;40\033[0;30;40m \033[0m" # Display white fg on black bg | |
for BG in $(jot - 41 47); do | |
CTRL="\033[0;30;${BG}m" | |
echo -en "${CTRL}" | |
echo -en "*;${BG}\033[0;30;40m " | |
done | |
echo -e "\033[0m" | |
# Bottom border | |
echo -e " \033[0;30;40m \033[0m\n" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment