Skip to content

Instantly share code, notes, and snippets.

@emersonmello
Forked from dylnmc/color_picker.sh
Created November 8, 2021 17:21
Show Gist options
  • Save emersonmello/2d88a36f534e6b6499774662091f49a4 to your computer and use it in GitHub Desktop.
Save emersonmello/2d88a36f534e6b6499774662091f49a4 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