Skip to content

Instantly share code, notes, and snippets.

@lisanhu
Last active September 2, 2021 06:18
Show Gist options
  • Save lisanhu/f99c8d1f44959f6989eabbc9c860c7e2 to your computer and use it in GitHub Desktop.
Save lisanhu/f99c8d1f44959f6989eabbc9c860c7e2 to your computer and use it in GitHub Desktop.
view terminfo colors and their corresponding color code
#!/bin/bash
# origin: https://unix.stackexchange.com/questions/269077/tput-setaf-color-table-how-to-determine-color-codes
color(){
for c; do
printf '\e[48;5;%dm%03d ' $c $c # adding one more space in the end to seperate the numbers
done
printf '\e[0m \n'
}
IFS=$' \t\n'
color {0..15}
for ((i=0;i<6;i++)); do
color $(seq $((i*36+16)) $((i*36+51)))
done
color {232..255}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment