Skip to content

Instantly share code, notes, and snippets.

@litvil
Forked from dylnmc/color_picker.sh
Created May 17, 2018 18:20
Show Gist options
  • Save litvil/6fdde49353d0ccb6cd0b5f343467b1fa to your computer and use it in GitHub Desktop.
Save litvil/6fdde49353d0ccb6cd0b5f343467b1fa to your computer and use it in GitHub Desktop.
#!/bin/sh
# view here:
# https://i.stack.imgur.com/OK3po.png
e=$'\e['
for n in {0..7}; do
printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
done
printf '\n'
for n in {8..15}; do
printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
done
printf '\n\n'
STEP='6'
START='16'
for i in {0..5}; do
for j in {0..11}; do
if (( $j < 6 )); then
n="$(( $START + ( $j * $STEP ) + $i))"
else
n="$(( $START + ( ( 17 - $j ) * $STEP ) + $i))"
fi
printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
done
printf '\n'
done
printf '\n'
START='93'
for i in {0..5}; do
for j in {0..11}; do
if (( $j < 6 )); then
n="$(( $START + ( $j * $STEP ) - $i))"
else
n="$(( $START + ( ( 17 - $j ) * $STEP ) - $i))"
fi
printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
done
printf '\n'
done
printf '\n'
START='160'
for i in {0..5}; do
for j in {0..11}; do
if (( $j < 6 )); then
n="$(( $START + ( $j * $STEP ) + $i))"
else
n="$(( $START + ( ( 17 - $j ) * $STEP ) + $i))"
fi
printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
done
printf '\n'
done
printf '\n'
for n in {232..243}; do
printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
done
printf '\n'
for n in {255..244}; do
printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
done
printf '\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment