Skip to content

Instantly share code, notes, and snippets.

@sydrawat01
Created May 5, 2022 18:09
Show Gist options
  • Select an option

  • Save sydrawat01/04286b7e04aeb8b7e73947ad98327edb to your computer and use it in GitHub Desktop.

Select an option

Save sydrawat01/04286b7e04aeb8b7e73947ad98327edb to your computer and use it in GitHub Desktop.
Run the script to see the color scheme of your terminal as a horizontal list of colors.
#!/bin/bash
# Show available terminal colours.
# Heavily modified version of the TLDP script here:
# http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
print_colors(){
echo
# Print rows.
for bold in ${bolds[@]}; do
for fg in ${fgs[@]}; do
# Print cells.
for bg in ${bgs[@]}; do
# Print cell.
printf "\e[%s;%s;%sm%s \e[0m\e " $bold $fg $bg " "
done
echo
done
done
}
# Print standard colors.
bolds=( 0 1 )
fgs=( 3{5..7} )
bgs=( 4{0..8} )
print_colors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment