Skip to content

Instantly share code, notes, and snippets.

@arthuralvim
Created January 17, 2016 15:00
Show Gist options
  • Save arthuralvim/220ca07466d3747e50ca to your computer and use it in GitHub Desktop.
Save arthuralvim/220ca07466d3747e50ca to your computer and use it in GitHub Desktop.
Generates an 8 bit color table (256 colors) for reference purposes.
#!/bin/bash
# Generates an 8 bit color table (256 colors) for
# reference purposes.
# credits for Michael.
# http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux
function boxcolor {
printf "\033[48;5;$1m \033[m "
}
echo "\n\n 8 BIT COLOR TABLE (256 COLORS)"
printf "\n + "
for i in {0..35}; do
printf "%2b " $i
done
printf "\n\n %3b " 0
for i in {0..15}; do
boxcolor ${i}
done
#for i in 16 52 88 124 160 196 232; do
for i in {0..6}; do
let "i = i*36 +16"
printf "\n\n %3b " $i
for j in {0..35}; do
let "val = i+j"
boxcolor ${val}
done
done
echo "\n\n END \n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment