Skip to content

Instantly share code, notes, and snippets.

@p1xelHer0
Created July 7, 2017 19:44
Show Gist options
  • Save p1xelHer0/b9dc3fe83d966a7c109bbfbcfed557a9 to your computer and use it in GitHub Desktop.
Save p1xelHer0/b9dc3fe83d966a7c109bbfbcfed557a9 to your computer and use it in GitHub Desktop.
# https://superuser.com/questions/270214/how-can-i-change-the-colors-of-my-xterm-using-ansi-escape-sequences
colortest() {
text='•‿•'
printf "base ";
for base in 00 01 02 03 04 05 06 07 08 09 '0A' '0B' '0C' '0D' '0E' '0F'; do
printf " ${base} ";
done
printf "\n";
for FG in 00 18 19 08 20 07 21 15 01 16 03 02 06 04 05 17; do
printf "\e[38;5;${FG}mcolor${FG}\e[0m ";
for BG in 00 18 19 08 20 07 21 15 01 16 03 02 06 04 05 17; do
printf " \e[38;5;${FG}m\e[48;5;${BG}m ${text} \e[0m ";
done
printf "\n"
printf "\e[1;38;5;${FG}mcolor${FG}\e[0m ";
for BG in 00 18 19 08 20 07 21 15 01 16 03 02 06 04 05 17; do
printf " \e[1;38;5;${FG}m\e[48;5;${BG}m ${text} \e[0m ";
done
printf "\n"
done
}
colortest_small() {
declare -a colors=( 00 07 01 16 03 02 06 04 05 17 )
for (( i = 1; i <= ${#colors[*]}; ++ i )); do
printf "\e[38;5;${colors[i]}m\e[48;5;${colors[i+1]}m█▓░\e[0m";
done
printf "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment